[m-rev.] for review: state vars syntax sugar
Mark Brown
mark at csse.unimelb.edu.au
Thu Jan 25 13:46:20 AEDT 2007
On 25-Jan-2007, Ben Schmidt <b.schmidt at ugrad.unimelb.edu.au> wrote:
> >(3) For consistency in the concrete syntax, I think a state-variable
> >mode pair should also be preceeded by !. That is, the following should
> >be equivalent:
> >
> >:- pred foo(!bar::!(in, out)) is det.
> >
> >:- pred foo(!bar).
> >:- mode foo(!(in, out)) is det.
> >
> >:- pred foo(bar, bar).
> >:- mode foo(in, out) is det.
> >
> >The ! symbol immediately alerts the reader to the fact that state
> >variables are being used. Just using a (_, _) pair for the modes
> >omits this helpful visual clue.
>
> There was lengthy discussion about this (thread: [m-dev.] syntactic
> suggar suggestion for state variables). I think the consensus of the
> list was *not* to use ! in the mode part of the declaration, but to have
> the syntax as Ondrej implemented it. Reasoning:
>
> - Using !(in,out) looks like it should expand to (in0,out0),(in,out),
> i.e. four arguments, or two pairs, which it doesn't.
> - If using ! as a functor for modes, it should take an inst argument if
> anything, but what is wanting to be done isn't parameterisable in terms
> of an inst argument (at least at present).
> - The syntax as implemented by Ondrej is the one suggested in the
> existing compiler code.
>
> Others can confirm that this was the consensus, or reopen the
> argument.... My vote is for the way Ondrej has done it.
The changes to the reference manual really should be reviewed first, and
hopefully we can reach consensus on that. *Then* we can more easily review
the code.
Cheers,
Mark.
--------------------------------------------------------------------------
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