[mercury-users] Mode System Hassles

Fergus Henderson fjh at cs.mu.OZ.AU
Wed Oct 20 10:34:02 AEST 1999


On 19-Oct-1999, Ralph Becket <rbeck at microsoft.com> wrote:
> It's becoming apparent to me that the mode system may *have* to be extended
> to somehow include parametric modes.

Yes, when you start using higher-order code or nested unique modes,
the lack of parametric modes can become a real pain.

> Question: if we abandon the (IMO not v. useful & poss. harmful) goal of
> passing around partially instantiated structures, doesn't the whole mode
> thing become much simpler?

Well, parametric modes do become simpler.
I don't think it simplifies the other aspects of the mode system much.
If you allow nested unique modes, then the compiler already needs to
do pretty much the same kind of stuff that it would need for partially
instantiated data structures.

In the Mercury mode system, insts record three kinds of information:
	- instantiation information
	  (whether something is free, ground, or partially instantiated)
	- subtype information
	- uniqueness information

Parameterizing over all three at once doesn't work, because if an inst
is completely unknown, then there's essentially nothing that you can
do with a value of that inst.

Parameterizing over just the subtype information (while keeping the
other parts fixed) is fairly simple, and could be done without much
difficulty, I think.  I've considered that in some detail, and in mail
to the mercury-developers mailing list about a year or so ago I
proposed extending Mercury along those lines.

Parameterizing over the uniqueness information is harder, but
could probably be done.

Parameterizing over the instantiation information gets quite tricky
indeed.

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