From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from discorde.inria.fr (discorde.inria.fr [192.93.2.38]) by yquem.inria.fr (Postfix) with ESMTP id B191FBC6B for ; Tue, 10 Jul 2007 13:13:29 +0200 (CEST) Received: from yquem.inria.fr (yquem.inria.fr [128.93.8.37]) by discorde.inria.fr (8.13.6/8.13.6) with ESMTP id l6ABDT3B021316 for ; Tue, 10 Jul 2007 13:13:29 +0200 Received: by yquem.inria.fr (Postfix, from userid 25991) id 4EC46BC6B; Tue, 10 Jul 2007 13:13:29 +0200 (CEST) Date: Tue, 10 Jul 2007 13:13:29 +0200 From: Daniel de Rauglaudre To: Caml List Subject: Re: [Caml-list] Camlp4s 4.02 Message-ID: <20070710111329.GA7621@yquem.inria.fr> References: <20070709094028.GB9408@yquem.inria.fr> <1183980485.26391.15.camel@rosella.wigram> <20070710083344.GA9032@yquem.inria.fr> <1184058519.14689.8.camel@rosella.wigram> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1184058519.14689.8.camel@rosella.wigram> User-Agent: Mutt/1.5.9i X-Miltered: at discorde with ID 469369D9.000 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; rauglaudre:01 rauglaudre:01 camlp:01 cmo:01 compilation:01 syntax:01 toplevel:01 semantics:01 compilation:01 syntax:01 cmi:01 ocamlc:01 compiler:01 semantics:01 toplevel:01 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/