[m-dev.] syntactic suggar suggestion for state variables
Mark Brown
mark at csse.unimelb.edu.au
Mon Jan 15 15:43:25 AEDT 2007
On 15-Jan-2007, Ben Schmidt <b.schmidt at ugrad.unimelb.edu.au> wrote:
> >However, I think the real problem is that the way insts are expressed in
> >Mercury's existing mode system does not allow the uniqueness to be easily
> >parameterised.
>
> I disagree; they can be easily parameterised when you realise that the
> true unique equivalent of in!out is not di!uo, but ui!uo:
>
> in!out: ground >> ground, free >> ground
> ui!uo: unique >> unique, free >> unique
The `ui, uo' modes would not typically be useful. For the second argument
to reuse the representation of the first argument (possibly after
destructively updating it) and be unique, the first argument needs to be
dead when the procedure exits. This is why io.state pairs always use `di'
for the input rather than `ui'.
The `ui' mode is intended for "read-only" parameters -- that is, where there
is only one argument rather than a state-variable pair of arguments.
Cheers,
Mark.
--------------------------------------------------------------------------
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