[m-dev.] syntactic suggar suggestion for state variables
Julien Fischer
juliensf at csse.unimelb.edu.au
Tue Jan 16 11:55:19 AEDT 2007
On Tue, 16 Jan 2007, Ben Schmidt wrote:
> That syntax solution seems pretty good, Richard.
>
> I'd go for the version that uses ! for variables and types, but parentheses
> only for modes, i.e. dot product type expansion of :: but not scalar*vector
> type expansion, and ! implying splitting one argument into two. I don't like
> it without any !s, as I think one type or variable shouldn't represent two
> without a !.
>
> Certainly best to save !(...) type notation for such time when modes/insts
> have been more thoroughly thought out. And although I like the conciseness of
> in!out, and don't think that clouds the meaning of ! like !(in,out) does,
> concede that the parentheses do seem to have the upper hand in terms of
> readability. So we'd have
>
> :- pred p(T, !acc_type, !io.state).
> :- mode p(M, (in, out), (di, uo)) is Det.
> p(V, !AccVar, !IO) :- Goal.
>
> :- pred pp(T::M, !acc_type::(in, out), !io.state::(di, uo)) is Det.
>
> lambda(V::M, !AccVar::(in, out), !IO::(di, uo)) :- LambdaGoal
>
> It is really obvious what it means, thoroughly consistent and not making
> premature use of !.
>
So after all that you finally arrived at the point that was already
suggested as an extension to state variable syntax anyway ;-)
( See compiler/state_var.m:282 ).
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