I agree this works around the limitation, but it does beg the question: why is the limitation there in the first place? On Tue, Sep 20, 2011 at 4:00 PM, Jacques Le Normand wrote: > first post! let's see if anyone can do better... > > module type Foo = sig type t end > module type Bar = sig type foo_t module Foo : Foo type t = foo_t end > > (* compiles *) > let g (type a) (m : (module Foo with type t = a)) = () > > (* fails to compile with a syntax error *) > let f (type a) (m : (module Bar with type foo_t = a)) = () > > > On Tue, Sep 20, 2011 at 3:36 AM, Yaron Minsky wrote: > > For some reason, 1st-class modules have more restrictive "with" syntax, > > which turns out to be a practical problem. > > > > The main constraint is that with constraints do not seem to be able to > refer > > to sub-modules. Consider the following code snippet: > > > >> module type Foo = sig type t end > >> module type Bar = sig module Foo : Foo end > >> > >> (* compiles *) > >> let g (type a) (m : (module Foo with type t = a)) = () > >> > >> (* fails to compile with a syntax error *) > >> let f (type a) (m : (module Bar with type Foo.t = a)) = () > > > > Of course, ordinary modules have no such constraint. Any thoughts as to > > what is going on here, and whether it can be fixed? This has really > > restricted designs I've been using, forcing me to flatten out structures > > that are more naturally nested. > > > > y > > > > > -- > 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 > >