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

Ralph Becket rafe at cs.mu.OZ.AU
Sat Feb 2 13:15:46 AEDT 2002


Michael Day, Saturday,  2 February 2002:
> 
> > > How about
> > > 
> > > 	Current:	!.X
> > > 	Next:		!:X
> > > 	Pair:		!X
> > 
> > I find this much more palattable than !=/!+.
> 
> Personally, I'm disappointed. Your original proposal was simply an
> inversion of DCGs using ! to indicate which calls *do* take extra
> arguments rather than { } to indicate which calls *don't*. It was easy to
> explain and easy on the eyes, whereas the latest proposals bear a distinct
> resemblance to line noise.

I don't think the situation is as bad as you make out.  The fine detail
being discussed refers to aspects that will (should) very rarely be
needed, namely when you need access to just one component of a state
variable (it's current or subsequent value).

The important part of the original proposal still stands and will be
all that most people need.

So we can now write (once this has been checked in)

	main(!IO) :-
		write_string("Hello, world!", !IO),
		nl(!IO).

But if you occasionally need access to just one component you can write

	main(!IO) :-
		print("starting", !IO),
		...
		Lexer0 = lex__start(..., !.IO),
		parse_input(ParseTree, Lexer0, Lexer),
		!:IO   = lex__stop(Lexer),
		...
		print("stopping", !IO).

Apart from changing +/- to ./: the scheme is pretty much identical.

- 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