[m-rev.] for review: Announce subtypes and coerce.

Peter Wang novalazy at gmail.com
Fri Apr 9 14:35:05 AEST 2021


On Wed, 07 Apr 2021 11:19:37 +1000 Julien Fischer <jfischer at opturion.com> wrote:
> > +
> > +  A term of type `real_color` can be converted to a term of type `color`
> > +  with `coerce(Term)`. A term of type `color` can be converted to a term of
> > +  type `real_color` if it has an appropriate inst.
> 
> That's better.  The one other I would mention here is that types and
> subtypes share their data representation, so coerce expressions do not
> cost anything.

Ok, I will add:

    Subtypes share a common data representation with their base types so
    the type conversions do not cost anything at runtime.

Peter


More information about the reviews mailing list