[m-rev.] global store implemented using typeclass

Fergus Henderson fjh at cs.mu.OZ.AU
Wed Jul 25 18:32:24 AEST 2001


On 23-Jul-2001, Holger Krug <hkrug at rationalizer.com> wrote:
> Appended you can find a `diff -c' to file
> mercury-compiler-rotd-2001-06-26/library/store.m adding global storage
> functionality. This is done by replacing type `store(S)' by typeclass
> `store' and declaring `io__state' as instance of typeclass `store'.

Thanks.  BTW, generally I find `diff -u' easier to read.

> ! % Proposal for a language extension: If we could define an abstract
> ! % typeclass `store' in the following way:
> ! % :- interface.
> ! % :- typeclass store(S).
> ! % :- implementation.
> ! % :- typeclass store(S) where [].
> ! % we could assure that it would be impossible to declare/define instances
> ! % of class `store' outside the current module.
> ! :- typeclass store(S) where [].

That language extension is already a part of Mercury.
The code here should use it.

The only other problem is the backwards compatibility issues.
I'm not sure what the best solution to the backwards compability problem is.
I can't see any better way than creating a new module and deprecating the old
one, as you suggested.

Apart from that, the code looks fine.

-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
The University of Melbourne         |  of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- the last words of T. S. Garp.
--------------------------------------------------------------------------
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