[m-rev.] for discussion: subtypes documentation
Ralph Becket
rafe at cs.mu.OZ.AU
Tue Nov 26 14:39:25 AEDT 2002
Mark Brown, Tuesday, 26 November 2002:
> Here's a new form of subtype declaration for discussion: subtypes with an
> implicit supertype. The declaration
>
> :- subtype t(P_i) ---> f_j(s_k).
>
> where each s_k is a subtype of some t_k, is equivalent to the
> declarations:
>
> :- type t_base(P_i) ---> f_j(t_k).
> :- subtype t(P_i) < t_base(P_i) ---> f_j(s_k).
>
> The body of the implicit supertype t_base is just the body of the
> subtype except that all types have been replaced by the base type.
>
> (Also, the name of the implicit supertype could be the same as the
> subtype without any serious ambiguity. Any reference to the name
> would refer to the subtype if subtypes are legal at that point,
> otherwise it would refer to the supertype. If the user needs full
> access to the supertype, they will have to declare it explicitly.)
Something is upsetting me about this suggestion, but I can't put my
finger on it! I think part of the problem is that these subtypes are
not proper subtypes because nobody has access to the supertype.
Wouldn't it just be easier to make ordinary type declarations also
generate a corresponding inst? Then the problem with subtypes as second
class citizens goes away, doesn't it?
- Ralph
--------------------------------------------------------------------------
mercury-reviews mailing list
post: mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------
More information about the reviews
mailing list