[m-dev.] syntactic suggar suggestion for state variables

Ben Schmidt b.schmidt at ugrad.unimelb.edu.au
Sun Jan 14 19:32:51 AEDT 2007


> What about:
> 
>     :- pred p(!mysvtype::in..out) is det.
> 
>     :- pred p(!mysvtype).
>     :- mode p(in..out) is det.
> 
> Or some other infix symbol?

I'd be happy with that, or even happier with '!' as the infix operator 
for consistency. I don't think it should be harder to parse.

:- pred p(!mysvtype::in!out) is det.

:- pred p(!mysvtype).
:- mode p(in!out) is det.

> What about something more like
> :- pred p(mysvtype::!(ground)) is det.
> 
> i.e. the argument is an inst, not a mode, so !(I) means in(I), out(I).
> or possibly allow omitting the inst altogether:
> :- pred p(mysvtype::!) is det.
> 
> "!" is not an ideal name for this.

I don't like that one, because it complicates doing things with unique 
modes rather than normal modes (in!out, ui!uo and di!uo could all be 
quite common to use what is now my preferred syntax :-)). Also because 
insts are something the average Mercury programmer delves into somewhat 
rarely (IMHO) and the construct for state variable types and modes was 
meant to make life easier, and to simplify the typing the programmer 
already did, not add to the required learning curve by requiring a 
deeper understanding of insts.

Ben.


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