[m-dev.] Ye Olde Subtyping Proposal

Ralph Becket rafe at cs.mu.OZ.AU
Tue Nov 19 13:25:22 AEDT 2002


Fergus Henderson, Tuesday, 19 November 2002:
> 
> Should the following example be legal?
> 
> 	:- type fruit ---> apple ; orange.
> 	:- subtype citrus < fruit ---> orange.
> 
> 	:- mode m == ...
> 
> 	:- pred p(fruit::m).
> 	:- external(p/1).
> 
> 	:- pred q(citrus::m).
> 	q(X) :- p(X).
> 
> My opinion is that it should be legal if m == out, but not if m == in.
> Next consider a similar example, but using mode inference rather than
> declared modes.  If the type checker has to do mode inference in order
> to determine type-correctness, then we have a problem...

I think you mean it should be legal of m == in, but not if m == out.

But it's a good point.  p/1 doesn't even have to be external for this to
be relevant.

- 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