[m-dev.] Polymorphic modes

Fergus Henderson fjh at cs.mu.OZ.AU
Wed May 2 19:38:46 AEST 2001


On 02-May-2001, David Overton <dmo at cs.mu.OZ.AU> wrote:
> On Tue, May 01, 2001 at 07:27:10AM -0700, Ralph Becket wrote:
> > Talking to Tyson and Peter, it seems the compiler does now
> > accept polymorphic modes (or at least some useful limited version
> > thereof).  However, I can't find any mention of this in the
> > documentation.  If there is some lying around, can someone post
> > it here or, preferably, add it to the reference manual.
> 
> Yes, the compiler now accepts a limited form of mode-polymorphism.
> You can place an inst variable in a mode declaration for a predicate
> or function, but the inst is constrained to be a "sub-inst" of ground
> (i.e. ground, bound(....) with all arguments ground, or a higher-order
> inst).
...
> The performance problem is the main reason why this feature has not
> yet been officially documented or used in the standard library.

Another problem is that currently it is unsound, due to RTTI
(std_util__construct, io__read and the like): using polymorphic modes
and RTTI, you can write programs that will seg fault.

-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
                                    |  of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- the last words of T. S. Garp.
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to:       mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions:          mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------



More information about the developers mailing list