From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id MAA16366; Tue, 19 Nov 2002 12:12:02 +0100 (MET) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id MAA16355 for ; Tue, 19 Nov 2002 12:12:02 +0100 (MET) Received: from verdot.inria.fr (verdot.inria.fr [128.93.11.7]) by concorde.inria.fr (8.11.1/8.11.1) with ESMTP id gAJBC1X00751 for ; Tue, 19 Nov 2002 12:12:01 +0100 (MET) Received: (from ddr@localhost) by verdot.inria.fr (8.9.3/8.9.3) id MAA18571 for caml-list@inria.fr; Tue, 19 Nov 2002 12:12:01 +0100 Date: Tue, 19 Nov 2002 12:12:01 +0100 From: Daniel de Rauglaudre To: caml-list@inria.fr Subject: Re: [Caml-list] Even at compile time 2*2=4! Message-ID: <20021119121201.A18538@verdot.inria.fr> References: <001901c28f7a$5a7feb30$3101000a@redmond.corp.microsoft.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <001901c28f7a$5a7feb30$3101000a@redmond.corp.microsoft.com>; from jakob.lichtenberg@attbi.com on Mon, Nov 18, 2002 at 07:18:34PM -0800 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk Hi, On Mon, Nov 18, 2002 at 07:18:34PM -0800, Jakob Lichtenberg wrote: > 2. Can I build a new top-level interactive environment 'ocaml_with_fourLib' > where this module is 'pre-loaded'. Again, the actual calculation of 2*2 > should be done when I build ocaml_with_fourLib - not when I start it. There is no difference between "load" a module and "start" it: the fact of loading it is starting it. In some cases, you could resolve your problem with Camlp4, if your computation can be done at parse time. We can imagine a syntax extension, e.g. "compute" followed by an expression, ask the preprocessor to evalutate it and build the syntax tree of the result. For example: compute (2*2) would generate at parse time: 4 But this could not work: let x = 2 in compute(x*x) because the preprocessor does not know what is "x". On the other hand, if "x" is defined as a directive to the preprocessor, for example with "DEFINE x = 2" (new syntax extension pa_macro.cmo), it could work. -- Daniel de RAUGLAUDRE http://cristal.inria.fr/~ddr/ ------------------- To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ Beginner's list: http://groups.yahoo.com/group/ocaml_beginners