[mercury-users] global state implemented

Holger Krug hkrug at rationalizer.com
Wed Jul 18 02:24:30 AEST 2001


> > Anyway, if you want to go ahead and implement this, I'll be happy to review
> > the code and to include it in the Mercury standard library (presuming the
> > other Mercury developers don't have any objections).  The implementation can
> > be similar to the implementation of mutvar in the store module.
> 
> Please first comment the additional changes proposed above.
> 

I now have found yet another way to implement global state, which I
will post to mercury-reviews as soon as I get my subscription. It does
not need a special module, but can be implemented as part of the
module `store' by switching from `type store(S)' to `typeclass
store(S)' with `instance store(io__state)' and replacing `store(S)' in
the predicate type declarations by a typeclass constraint.

The implementation should be mostly backwards compatible. The
programmers interface remains the same as it was, because the changes
in interface declarations concern only the existentially quantified
type store(S). The only difference is, that now besides stores created
using `store__new/1' additionally each value of type `io__state' can
serve as a store.

At least I think my implementation should work, it's still untested,
and I'm very keen to hear about the results of the review.

-- 
Holger Krug
hkrug at rationalizer.com
--------------------------------------------------------------------------
mercury-users mailing list
post:  mercury-users at cs.mu.oz.au
administrative address: owner-mercury-users at cs.mu.oz.au
unsubscribe: Address: mercury-users-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-users-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the users mailing list