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

Ralph Becket rafe at cs.mu.OZ.AU
Thu Jan 31 11:12:46 AEDT 2002


Holger Krug, Wednesday, 30 January 2002:
> 
>  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

That's starting to look too much like Perl for my tastes.

> with    VAR += EXPR    :=       !VAR = ?VAR + EXPR
>         VAR *= EXPR    :=       !VAR = ?VAR * EXPR

If it turns out that programs would be made significantly clearer then
there will be a case for adding this sort of syntactic sugar, but I'm
skeptical.

Nineteen times out of twenty, !X will be sufficient.  I find it hard to
conceive of a situation where I'd use imperative style like this to such
an extent that it would warrant yet more syntax.  On that basis, I've
decided I'm not too bothered what option (![.:,=+,<>,...]) we pick.

- Ralph
--------------------------------------------------------------------------
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