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

Ben Schmidt b.schmidt at ugrad.unimelb.edu.au
Mon Jan 15 12:49:33 AEDT 2007


> I don't care much about the choice between !(in, out) and in!out. Both 
> are nice (but see below). I would just definitely stick to the same 
> symbol (!).

Same. Both could perhaps be offered. I think both are very clear; I just 
have a real adversion to unnecessary parentheses.

> However I like the idea of mode variables (not inst variables), because 
> the !(in, out) and !(di, uo) variants of the same predicate could then 
> have the same !(Mode) mode declaration.

I love this idea.

> With such a future extension in mind, I'd disfavor in!out or I!O (for 
> rather unspecified style issues).

But disagree with that one. Both declarations seem OK to me, and my 
preference is still for the infix version.

> For extra lazy people, bimode variables could be allowed:
> 
>   !Aku::!IO

In light of that, I'd especially prefer I!O to !(I,O), as if !IO implies 
two variables !(I,O) borders on implying four. The benefit of I!O is 
that you either don't understand the syntax at all, or you realise 
clearly that it implies no extra variables, unlike all the other ! 
notations.

> but this could make error messages incomprehensible if you forgot one of 
> the (!) somewhere, or worse, if you forgot one in the mode and one in 
> the type declarations:

I doubt this would be a big problem. Forgetting one or the other in a 
combined type/mode declaration should be picked up as a syntax error anyway.

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