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
Invoking the standard library ?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2008-04-29 (18:20)
From: Eric Cooper <ecc@c...>
Subject: Re: [Caml-list] Invoking the standard library ?
On Tue, Apr 29, 2008 at 04:26:45PM +0200, David Teller wrote:
> modules String, Stream, etc. For this, I need to include the original
> module, as provided in the standard library, and add stuff. Now, the
> trick is that I'd like to keep the same name as the original module.

My first thought was that the usual shadowing of bindings could
be used, and indeed the following works fine in the toplevel:

module String =
    include String
    let my_extension = ...

But when I tried to compile it separately (just
    include String
    let my_extension = ...
in a file ""), I got an error "Unbound module String".

I don't understand why the behavior is different in these two cases;
apparently the batch compiler binds String as soon as it starts compiling
"", whereas the top-level does so only after compiling the
struct body.  Is this a bug?

Eric Cooper             e c c @ c m u . e d u