Re: why customize toplevel

"'Mr. Herr' [email protected] [ocaml_beginners]" <[email protected]>
Newsgroups gmane.comp.lang.ocaml.beginners
Message-ID <[email protected]>
BTW, because doylejonathan is customizing his toplevel:

Is there a good reason to build a customized version of the toplevel, apart the fact that
startup is streamlined a bit? (and apart the fun...)

I would normally use .ocamlinit files for this.

/Str.


On 11.09.2015 11:20, Gabriel Scherer [email protected] [ocaml_beginners] wrote:
> The toplevel will only type-check modules whose .cmi file it has access to
> (regardless of whether its actual implementation in a .cmo or .cma can be
> loaded). If the .cmi file is not at the root of the current directory or in
> an include path (standard library, -I options), you can add their
> directories to the toplevel by using the directive #directory:
>
>    #directory "subdir";;
>    (* now you can use Foo whose interface is given in subdir/foo.cmi *)
>
> On Fri, Sep 11, 2015 at 11:04 AM, [email protected]
> [ocaml_beginners] <[email protected]> wrote:
>
>>
>> This morning I copied my "root" OCaml directory containing all
>> my OCaml projects, to a different location on the same computer.
>> But a lot of weird things happened when I started to work in
>> the new directory.
>>
>> In case someone should ask, yes I checked that my makefile does
>> not contain any mention of the path to the directory it's in, and
>> yes when in my new directory first thing I did was delete all the
>> cma/o/i's and
>> recompile everything from scratch (and I repeated this operation when
>> trying to figure out what was wrong).
>>
>> The weird things happen with my customized toplevel :
>>
>> Weird phenomenon 1: even though the production/compilation
>> of the toplevel goes fine with zero warnings, the created
>> toplevel only knows about the modules whose .ml file is
>> situated in the root dicrectory. All the modules whose .ml
>> file is situated in a subdirectory are declared unbound.
>>
>> Weird phenomenon 2 : When I see that my toplevel does not
>> know about the module implemented in subdir/my_module.ml,
>> I naturally try the directive #load"subdir/my_module.cmo".
>> The toplevel recognizes the file (I know that because it does
>> not issue a "Cannot find file" message), but the module
>> My_module is still unbound after the directive has been
>> executed.
>>
>> Any help appreciated.
>>
>>
>>
>>
>>
>>
>>
>>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.