[m-dev.] Reopened: state vars syntax sugar

Julien Fischer juliensf at csse.unimelb.edu.au
Mon Jan 29 12:27:23 AEDT 2007


On Mon, 29 Jan 2007, Ondrej Bojar wrote:

> A slight problem is that ::! is a single token so:
> :- pred p1(!foo::!ground) is det.
>
> renders a syntax error and extra parentheses have to be used:
> :- pred p1(!foo::(!ground)) is det.

So far the only people in favour of the !<inst> syntax all seem
to be named Peter.  I'm not convinced it's a particularly good idea.

> or we need to tweak library/lexer.m
> or library/ops.m to add "::!" as a new operator.
> (Which is the preferred choice?)
>
> To the other issue: There are two ways to avoid (syntax) wars: a) creeping 
> featurisis, b) dictatorship. In this particular case, I would vote for a) and 
> support both:
>
> :- pred p(!type::!(in, out)) is det.
> :- pred p(!type::!ground) is det.

I'm also unconvinced by the !(in, out) syntax.  I agree with Richard,
in the original thread, that ! should be restricted to circumstances
where it indicates that two of a thing are introduced; this is not
the case with the modes, there are already two of them.

> The arity of ! makes a clear distinction between the inst/modes way of 
> specification. For new users, modes are easier to comprehend, and state 
> variables (popular for their conciseness beauty) could actually serve as a 
> nice link for delving into instantiations.
>
> But in case there is an approved dictator for syntax issues, I'm willing to 
> obey.
>
> Cheers, Ondrej.
>
> P.S.: If there is no dictator, how do you arrive at final conclusions? (Two 
> approvals for a diff justify a commit?

No one has said anything about committing this state variable stuff yet.

> That does not sound like a stable 
> procedure if the environment ceased to be cooperative. ;-)

As both Ralph and myself have said, we would like to see the proposed
changes written up in the reference manual (and the diffs posted here)
before considering this further.

Cheers,
Julien.
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to:       mercury-developers at csse.unimelb.edu.au
Administrative Queries: owner-mercury-developers at csse.unimelb.edu.au
Subscriptions:          mercury-developers-request at csse.unimelb.edu.au
--------------------------------------------------------------------------



More information about the developers mailing list