Version française
Home     About     Download     Resources     Contact us    
Browse thread
Replacing Pervasives?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Romain Bardou <Romain.Bardou@l...>
Subject: Re: [Caml-list] Replacing Pervasives?
David Teller a écrit :
> Would that open anything by default?
> 
> 
> On Mon, 2008-09-08 at 12:04 +0200, Romain Bardou wrote:
>> I guess you could try and make your own stdlib directory, and then
>> call 
>> ocamlc using:
>>
>> ocamlc -nostdlib -I mystdlib
>>
>> or something like that...
>>

My guess is that it would try to open mystdlib/Pervasives.cmo...

In other word it's as if you changed your "official" 
stdlib/Pervasives.cmo except that it's cleanier as you don't actually 
override it (which would change your Pervasives for all your projects).

I didn't try it though, so maybe I'm missing something.

Another way to automatically open your module would be to do a weird 
Makefile such as:

%.cmo: %.ml
     echo "open Myperv;;\n" > $*.temp.ml
     cat $*.ml >> $*.temp.ml
     ocamlc -c $*.temp.ml -o $*.cmo
     rm $*.temp.ml

Or you could do this using some Ocamlbuild plug-in, or just by using the 
-ocamlc option of Ocamlbuild...

Basically, just use any hack which can replace your ocamlc by a script 
which adds "open Myperv;;\n" before calling ocamlc ^^

-- 
Romain Bardou