Browse thread
[Caml-list] Forward references
- brogoff@s...
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | brogoff@s... |
| Subject: | [Caml-list] Forward references |
Hi,
I was browsing the mailing list archives when I reread the article
http://caml.inria.fr/archives/199902/msg00020.html
where it was mentioned that there was once some kind of experimental forward
declaration feature in an earlier Caml. This was used to get full polymorphic
recursion in the language (it served as a mandatory type constraint) and it
was also discussed as a way to get some cross module recursion without the
ugly "ref to function" hack mentioned in the manual.
I'm curious as to whether types could also be forward declared, or deferred,
as well, and if this forward ref machinery could deal with the problem of
instantiating a functor which is in a recursive relationship with a type, as in
the following faux-Caml
forward type composite = { data : string ; children : CompositeSet.t }
and cmp x y = Pervasives.compare x.data y.data
and module CompositeSet = Set.Make(module type t = composite let compare = cmp end)
This is a lighter approach than the one involving MoscowML recursive
modules, since there is no extra module wrapper, but can probably be transformed
into the mosml style mechanically. Is there some showstopper that prevents this
(admittedly half baked) approach from being feasible?
I'd really like to see some solution to the above mentioned problems in
OCaml sooner rather than later.
-- Brian
-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners