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] Recursive modules and polymorphic recursion
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Xavier Leroy <xavier.leroy@i...>
Subject: Re: [Caml-list] Recursive modules and polymorphic recursion
>     I was playing with the recursive modules in the CVS snapshot and
> much to my chagrin the very first pr function of the very first pr
> example in Okasaki causes the system to barf, where barf means
> "Cannot safely evaluate the definition of the recursively-defined
> module RAListImpl". Is this a temporary limitation of the CVS
> version or a permanent limitation of the feature?  I've appended the
> code to this email.

As the design document explains
the current implementation of recursive modules is such that a definition
        module rec A : SIGA = StructA
is accepted only if all value components of SIGA are functions.  This
isn't the case in your example because of the "empty" value component.
This restriction comes from the way ill-founded recursions are
detected at run-time.

Yes, it's an unfortunate restriction, and eventually it will go away
once I figure out a suitable static analysis for well-foundedness of
recursive definitions.  But this may take a while.

The decision to integrate recursive modules in 3.07 was taken on the
grounds that imperfect recursive modules are still better than no
recursive modules at all.  Be patient: perfection takes time.

- Xavier Leroy

To unsubscribe, mail Archives:
Bug reports: FAQ:
Beginner's list: