[m-dev.] polymorphic modes

Ralph Becket rbeck at microsoft.com
Wed Feb 9 22:49:28 AEDT 2000


The syntax

:- mode p(in(I), out(I)) <= I is ground.

(or whatever variant) is fine, but I wonder if we could make
`I is ground' the default assumption, in the same way that
we have a default assumption for function modes?

It seems to me that the bulk of the requirement for polymorphic
modes lies with higher order programming, perhaps followed by
(nested) unique arguments.  Since a substantial part of the 
standard library (and other code) is concerned with various
types of collection, it would be mildly annoying to have to
specify `I is ground' everywhere that an higher order argument
could be passed.

On the other hand, it won't be that great a burden.

Ralph

> One problem that people writing code using this extension
> will run into is that the standard library does not use
> polymorphic modes.  So for code that uses the standard
> library, it will typically not be OK to give the code a
> polymorphic mode declaration.
> 
> One solution would be to change all the appropriate mode
> declarations in the standard library to be polymorphic. 

This gets in my way so often that I volunteer to handle
the change if this scheme is adopted.

> Another solution would be to propagate polymorphism in
> the types into the modes, as alluded to in my proposal
> for subtypes.  But that would require adding type class
> constraints in various places, which would break backwards
> compatibility.

I'm happy for that to happen for v2 if it means having a
more comfortable language.

Cheers,

Ralph
--------------------------------------------------------------------------
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