On Tue, Dec 13, 2011 at 21:56, Jacques Garrigue
<[email protected]> wrote:
> In your example, how do you know in a pattern-matching that `Foo comes from 
> t2?
> Type inference could be used, but I'm afraid it would be very fragile,
> and  not easy to use.
> So at this point there is no plan to add GADT PVs.
>
> An alternative design would be to have extensible GADTs, where you would be 
> able
> to add new cases, like for exn.
> I think this would be useful, and cover some uses that are not
> possible even with PVs.

I really like using PVs for defining extensible, recursive DSLs.  If
it were possible to use GADTs in a similar way, that would be an
awesome feature.  But I wonder how this could be done cleanly.  I
agree that type inference would be impractical when combining PVs and
GADTs, since PV constructors are not tied to a specific type.

It seems you have something in particular in mind when you speak of
extensible GADTs.  Wouldn't such a feature require that GADTs have the
same runtime representation as PVs, i.e. using the hash value of the
variant name?  Not sure what the GADT representation is right now
anyway, but maybe this should be determined carefully before the next
release if we want to add extensibility later.

Regards,
Markus

-- 
Markus Mottl        http://www.ocaml.info        [email protected]


-- 
Caml-list mailing list.  Subscription management and archives:
https://sympa-roc.inria.fr/wws/info/caml-list
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs

Reply via email to