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 TAA28440; Tue, 19 Nov 2002 19:09:04 +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 TAA28463 for ; Tue, 19 Nov 2002 19:09:03 +0100 (MET) X-SPAM-Warning: Sending machine is listed in blackholes.five-ten-sg.com Received: from opus.davidb.org (66-27-72-19.san.rr.com [66.27.72.19]) by concorde.inria.fr (8.11.1/8.11.1) with ESMTP id gAJI92X22681; Tue, 19 Nov 2002 19:09:02 +0100 (MET) Received: from davidb by opus.davidb.org with local (Exim 3.31 #1 (Debian)) id 18ECo0-0006U6-00; Tue, 19 Nov 2002 10:09:00 -0800 Date: Tue, 19 Nov 2002 10:09:00 -0800 From: David Brown To: Daniel de Rauglaudre Cc: caml-list@inria.fr Subject: Re: [Caml-list] Even at compile time 2*2=4! Message-ID: <20021119180900.GA24889@opus.davidb.org> References: <001901c28f7a$5a7feb30$3101000a@redmond.corp.microsoft.com> <20021119121201.A18538@verdot.inria.fr> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20021119121201.A18538@verdot.inria.fr> User-Agent: Mutt/1.4i Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk On Tue, Nov 19, 2002 at 12:12:01PM +0100, Daniel de Rauglaudre wrote: > 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". To be useful, you would probably also have to be able to define functions for the preprocessor that could be used to compute the value. This also makes the interesting possibility of compiles that don't terminate... compute (forever ()) Dave Brown ------------------- 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