[m-rev.] For review: State-variable record update transformation

Peter Schachte schachte at csse.unimelb.edu.au
Mon Mar 5 16:12:10 AEDT 2007


Jonathan Morgan wrote:
> This change is a syntactic sugar, done for convenience.  The syntax
> you suggest provides no additional convenience, and does not strike me
> as at all natural.  The reason why is exactly as Julien said: in
> Mercury, the `!' operator is used to indicate an operation on the
> current state to derive the next state.  Allowing !Var := Term as a
> synonym for !:Var = Term destroys these semantics, as it completely
> ignores the previous state.  I do not expect Mercury to work like
> that, and I do not wish it to work like that.

I can't see why you want to require yourself to use the previous value in
setting the next, but anyway, you can't.  There are lots of ways I can replace
the value of a state thread using only the !X (not !:X) notation.

I always find it annoying when a construct is defined for one or more of
something even though it makes perfect sense for it to work for zero or more.
It just seems untidy and non-orthogonal that I can write

	!Position ^ x := 7,
	!Position ^ y := 42

but not the equivalent

	!Position := position(7,42).

Instead I have to switch to a different language construct:

	!:Position = position(7,42)

which looks deceptively similar.  It's a sharp edge left left in the language
for no good reason.  Sure, it's not a big enough sharp edge to really hurt
yourself.  But still, why leave it there?

-- 
Peter Schachte              Basically, Clinton's approach to America is,
schachte at cs.mu.OZ.AU        "Vote for me, I'm not Newt Gingrich."
www.cs.mu.oz.au/~schachte/      -- Ralph Nader
Phone: +61 3 8344 1338
--------------------------------------------------------------------------
mercury-reviews mailing list
Post messages to:       mercury-reviews at csse.unimelb.edu.au
Administrative Queries: owner-mercury-reviews at csse.unimelb.edu.au
Subscriptions:          mercury-reviews-request at csse.unimelb.edu.au
--------------------------------------------------------------------------



More information about the reviews mailing list