Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] mutually referencing compilation units
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: John Max Skaller <skaller@o...>
Subject: Re: [Caml-list] mutually referencing compilation units
Xavier Leroy wrote:

>>Is the fact that two mutually referencing units can't be compiled
>>supposed to be a Good Thing?
>>
> 
> No, it is acknowledged as an unfortunate limitation and an annoyance
> to the programmer.  However, there are deep semantical and
> type-theoretical reasons that make it hard to allow cross-module
> recursion in ML.  This is actually a research area that is still
> largely open.


I'm curious if there is a "lay" explanation of what these restrictions 
are. Felix supports intermodule recursion (with some constraints).
Indeed, there is no explicit construction for sequential module 
definitions (you can do it using nesting).

One of the key distinctions which might make this possible in
Felix is that function declarations:

	fun f(i:int):int { return i; }

do NOT declare values. Thus, the above (which maps semantically
to a C++ class) is quite distinct from

	val g = f;

where g is a function closure
(which maps to C++ object of class f).

The recursion allowed includes type recursion too.

The constraint only applies to open directives
and is related to name lookup, not typing.
Since opening a module may lift a name into the current
scope, there is a constraint on the names of modules
being opened .. since it has to be independent of
the order of opening other modules.



-- 
John Max Skaller, mailto:skaller@ozemail.com.au
snail:10/1 Toxteth Rd, Glebe, NSW 2037, Australia.
voice:61-2-9660-0850


-------------------
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