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

[Caml-list] real lazy?
[ 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 Subject: Re: [Caml-list] real lazy?
```Francis Dupont wrote:
>
> I've got Chris Okasaki's "Purely Functional Data Structures"
> (a very nice book). Of course, I've tried to program the examples
> (I needed some training with functors :-) and I've found some
> issues:
>  - no recursion in modules (1) but I don't complain because
>    this cannot (should not!) be done

It can be done with suitable constraints.
Intermodule function calling is no problem in Felix!
Nor is intermodule type dependence, provided
the types aren't mutually recursive,
and even that works provided there is an 'object boundary'
in the way such a union of variants.

In fact, ALL definitions in Felix
at the same scope are mutually recursive.
You have to work hard to get a linear ordering!

[Getting 'open' to work at the same scope as the
module it opens was some fun!]

> PS: more:
>
> 1- recursion in modules:
>  module A = struct type t = C of B.tt ... end
>  module B = Make(A)
> where Make is a functor. A uses B which is built from A.

Agree: the Felix equivalent won't work either.
But it tries, and reports an error: not all intermodule
recursions are unsound (not all sound ones are admitted,
but some of them are, including function calling).

Interestingly: Felix applies functors
in a trivial way that permits recursion into functor
instances where the corresponding intermodule
recursion is also allowed: the functor instance
is constructed 'on demand' rather than wholistically.

What is not permitted
is an interface recursion, since matching interfaces
to modules is done wholistically (even when the
interface/module component pair isn't used).

--
John (Max) Skaller, mailto:skaller@maxtal.com.au
10/1 Toxteth Rd Glebe NSW 2037 Australia voice: 61-2-9660-0850
New generation programming language Felix  http://felix.sourceforge.net
Literate Programming tool Interscript
http://Interscript.sourceforge.net
-------------------
Bug reports: http://caml.inria.fr/bin/caml-bugs  FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr  Archives: http://caml.inria.fr

```