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

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Daniel de Rauglaudre <daniel.de_rauglaudre@i...>
Subject: Re: [Caml-list] Camlp4s 4.02
Hi,

On Tue, Jul 10, 2007 at 07:08:39PM +1000, skaller wrote:
> >     #load "fred.cmo";
> 
> yes, but it only works in the top level, where it is a burden.
> It doesn't work where it is actually needed: batch compilation.

Yes, it does ! It has the same syntax than in the toplevel because it
has the same semantics : loading. In batch compilation, it means
"load in the preprocessor context".

> besides .. that command does dynamic loading, which is not
> the same as specifying a syntax.

I am sorry, but do you know that when you use "open Module" in a file,
the file "module.cmi" is "dynamically loaded" in ocamlc ? Ok, this is
not code, but it is the same idea: loading something in the compiler
to change its behaviour.

If you don't like the syntax "#load", ok, but the semantics is correct
and fully consistent with the same one in the toplevel.

> For dynamic loading the syntax is evil: the .cmo should not be
> required

This is not evil, this is great ! All the principle of camlp4 is that
syntax extensions are code previously compiled (therefore compilable)
and loaded in the preprocessor.

Well, if you want to "hide" that to the user, ok, but it is a problem
of "shell", not a problem of "kernel". Camlp4 is good in its fundamental
principles.

And I defend the idea that syntax extensions are loaded code. This is
Michel Mauny's basic idea and I agree with him. It is a the beauty of
camlp4.

> (it could be native code loading native code .. :)

It cannot be native code, because camlp4 uses only bytecode, and
the "#load" being done in the preprocessor, there is no difference
whether you compile your file by ocamlc or ocamlopt.

This "#load" does not mean "load in the program" but "load in the
preprocessor". This is a *directive*, indicating clearly that it is
information for the compiler, not for the user program.

-- 
Daniel de Rauglaudre
http://pauillac.inria.fr/~ddr/