[m-dev.] for review: extra modes for random.m

Fergus Henderson fjh at cs.mu.OZ.AU
Thu Mar 1 03:47:53 AEDT 2001


On 28-Feb-2001, Ralph Becket <rbeck at microsoft.com> wrote:
> > From: Peter Schachte [mailto:schachte at cs.mu.OZ.AU]
> > 
> > I think Tom's right.  I can think of only two reasons for using a
> > non-[m]di/[m]uo mode:  (1) because you for some reason want the same
> > sequence of random numbers in two places in your code; and (2) because the
> > incompleteness of the uniqueness system makes it too painful to live with
> > the existing modes, so you'd rather lose the checking.  I don't think (1)
> is
> > a good reason for the change because I doubt it would come up very often,
> > and it can be handled other ways.  The problem with reason (2) is that
> when
> > the uniqueness system is eventually fixed, you'll want to take away the
> new
> > modes to get back the checking, but this will break people's code.
> 
> (1) seems perfectly legitimate to me - there's nothing in that code that
> *requires* mostly-uniqueness; those modes are partly there as a common case 
> sanity check for the unwary programmer (not a bad thing, mind you).
> (2) I've been hoping for yea since the Middle Ages, but these things 
> take time.
> 
> The thing is, if you want protection of type (1) then you just need to
> ensure that you use a mostly-unique mode for your random__supplies and
> the mode checker will spot the sort of errors you're talking about.

Right. 

Furthermore I would argue that `mdi' modes were intended to model
backtrackable destructive update, and so using `mdi' modes when you're
not actually doing any backtrackable destructive update is not
necessarily such a good idea.  I think Ralph's experience in using
them is that allowing *only* mdi/muo modes causes much more pain than
it is worth.  Allowing in/out modes too doesn't prevent such checking,
it just makes it optional.

> p.s. Thanks to an e-mail problem, I checked in the change before I
> got to see your response.  I hope it doesn't get backed out because
> I need it to work.

In general if there is any controversy, then it is a good idea to
wait at least a couple of days to give others on the list a chance
to respond and put their point of view.

But in this case I think you're right and so I'm happy that it has
been committed.

-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
                                    |  of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- the last words of T. S. Garp.
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to:       mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions:          mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------



More information about the developers mailing list