[m-dev.] subtypes discussion

Fergus Henderson fjh at cs.mu.OZ.AU
Sun Jan 5 13:14:45 AEDT 2003


OK, that all sounds good.  Go for it!

On 05-Jan-2003, Mark Brown <dougl at cs.mu.OZ.AU> wrote:
> On 04-Jan-2003, Fergus Henderson <fjh at cs.mu.OZ.AU> wrote:
> > Did we resolve what happens if subtypes are used in the RHS of type
> > definitions?  If so, what was the conclusion?
> 
> I was going to be conservative for the first implementation and disallow
> them.  For now, if users want to use a subtype in some data structure they
> must declare a base type (using a 'type' declaration) _and_ a subtype for
> the data structure.  Likewise, I was only going to allow the basic form of
> the declaration at first -- we can discuss later which variants of the
> declaration should also be supported.
> 
> On the issue of existentially typed constructors:
> 
> On 25-Nov-2002, Fergus Henderson <fjh at cs.mu.OZ.AU> wrote:
> > I think we should make a decision as to whether
> >
> >       (1) subtypes should implicitly inherit all the properties of the
> >           supertype (with the actual subtype this being defined as the
> >           intersection of the supertype with the constraints imposed by
> >           the body of the subtype definition)
> >
> > or
> >
> >       (2) subtypes bodies are required to be an actual subtype of
> >           the supertype.
> >
> > (1) allows for more concise source code.
> > (2) means that the set of values which satisfy a subtype declaration
> >     can be understood directly without needing to reference the supertype
> >     definition.
> 
> The original proposal, and the discussion since, takes position (2),
> with the exception that underscore variables implicitly inherit the base
> type of the supertype.  So I think we all agree that position (2) is
> generally the right choice, and I'll go with that one.  In particular:
> 
> > If we go with (2), then subtype declarations would be allowed to contain
> > existential types and type class constraints (which would be required
> > to match that in the main type).
> 
> Cheers,
> Mark.
> 
> --------------------------------------------------------------------------
> 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
> --------------------------------------------------------------------------

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