Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
[Caml-list] Forward references
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: brogoff@s...
Subject: [Caml-list] Forward references
    I was browsing the mailing list archives when I reread the article

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 =  
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 Archives:
Bug reports: FAQ:
Beginner's list: