[m-rev.] Add `:- mutable' declaration to the language.

Julien Fischer juliensf at cs.mu.OZ.AU
Thu Sep 1 15:21:23 AEST 2005


On Thu, 1 Sep 2005, Ian MacLarty wrote:

> On Thu, 1 Sep 2005, Ralph Becket wrote:
>
> > Estimated hours taken: 24
> > Branches: main
> >
> > Add `:- mutable' directives to the language, providing modules with private
> > mutable variables.  A directives
> >
> > :- mutable(x, int, 0, ground, [thread_safe]).
> >
> > leads to the compiler generating the following:
> >
> > :- semipure pred get_x(int::out(ground)) is det.
> > :- impure   pred set_x(int::in(ground)) is det.
> > :-          pred initialise_mutable_x(io::di, io::uo) is det.
>
> Can we have pure versions of get_x and set_x which take the I/O state?
>
It would mean that the module would have to import the io module.  You
may not want to do that.

Julien.
--------------------------------------------------------------------------
mercury-reviews mailing list
post:  mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the reviews mailing list