You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have three wishes to submit, the first two are related.
First :
It would be nice in a foo.mli to be allowed to refer to a type t exported in
this mli with Foo.t instead of t. This to allow to define another type
named t in a submodule, while leaving Foo.t visible in the interface of the
submodule.
Second :
The current implementation of module Set does not allow to define recursive
types using sets : for instance n-ary trees where the sons of a node are
stored in a set. One could fix this problem this way (provided my first
wish is implemented) :
type 'a t
module Make (Ord:OrderedType) : S with type elt=Ord.t and type t=Ord.t Set.t
That way, it remains compatible with existing programs.
Third :
Would it be possible to have a conscruct like :
let module Foo = match expr with
| pat1 -> Module1
| pat2 -> Module2
...
in ...
I guess that first class modules are not trivial to implement, but
such a limited construct should not be too difficult, and would add a lot
of flexibility.
Anyway, thanks a lot for your wonderful language !
The text was updated successfully, but these errors were encountered:
Touches on two difficult (but desirable) extensions of the module system:
first-class modules and recursive modules. No solution yet or in the near
future.
Original bug ID: 404
Reporter: administrator
Status: closed
Resolution: won't fix
Priority: normal
Severity: feature
Category: ~DO NOT USE (was: OCaml general)
Bug description
Full_Name: Luc Habert
Version: 3.01
OS: Linux
Submission from: bastet.loria.fr (152.81.7.147)
I have three wishes to submit, the first two are related.
First :
It would be nice in a foo.mli to be allowed to refer to a type t exported in
this mli with Foo.t instead of t. This to allow to define another type
named t in a submodule, while leaving Foo.t visible in the interface of the
submodule.
Second :
The current implementation of module Set does not allow to define recursive
types using sets : for instance n-ary trees where the sons of a node are
stored in a set. One could fix this problem this way (provided my first
wish is implemented) :
type 'a t
module Make (Ord:OrderedType) : S with type elt=Ord.t and type t=Ord.t Set.t
That way, it remains compatible with existing programs.
Third :
Would it be possible to have a conscruct like :
let module Foo = match expr with
| pat1 -> Module1
| pat2 -> Module2
...
in ...
I guess that first class modules are not trivial to implement, but
such a limited construct should not be too difficult, and would add a lot
of flexibility.
Anyway, thanks a lot for your wonderful language !
The text was updated successfully, but these errors were encountered: