[m-dev.] State variable syntax - last call for opinions

Holger Krug hkrug at rationalizer.com
Wed Jan 30 22:05:18 AEDT 2002


On Wed, Jan 30, 2002 at 07:09:23PM +1100, Fergus Henderson wrote:
> How about
> 
> 	Current:	!.X
> 	Next:		!:X
> 	Pair:		!X
> 

How about

 	Current:	?X
 	Next:		!X
 	Pair:		!?X  := !X, ?X
 			?!X  := ?X, !X

Here the arity of the pair is explicitely expressed: each `!', `?'
makes its contribution to the arity.

> Then you have
> 
> 	!:X = 0,		% Initialize it
> 	p(!X),			% Update it
> 	!:X = !.X + 1,		% Increment it
> 	p(!X),			% Update it some more
> 	Last = !.X		% Read it

 Then you have
 
 	!X = 0,			% Initialize it
 	p(?!X),			% Update it
 	!X = ?X + 1,		% Increment it
        X += 1,                 % Increment it once again
 	p(?!X),			% Update it some more
 	Last = ?X		% Read it

with    VAR += EXPR    :=       !VAR = ?VAR + EXPR
        VAR *= EXPR    :=       !VAR = ?VAR * EXPR
        etc.

-- 
Holger Krug
hkrug at rationalizer.com
--------------------------------------------------------------------------
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