From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from weis@localhost) by pauillac.inria.fr (8.6.10/8.6.6) id SAA25961 for caml-redistribution; Fri, 17 Nov 1995 18:18:29 +0100 Received: (from mauny@localhost) by pauillac.inria.fr (8.6.10/8.6.6) id RAA25588; Fri, 17 Nov 1995 17:29:12 +0100 Message-Id: <199511171629.RAA25588@pauillac.inria.fr> Subject: Re: Quotations in Caml-Special-Light and Caml-Light To: ddr@peray.inria.fr (Daniel de Rauglaudre) Date: Fri, 17 Nov 1995 17:29:12 +0100 (MET) Cc: caml-list@pauillac.inria.fr, coq@pauillac.inria.fr In-Reply-To: <199511171358.AA28851@peray.inria.fr> from "Daniel de Rauglaudre" at Nov 17, 95 02:52:03 pm From: Michel.Mauny@inria.fr (Michel Mauny) Reply-to: Michel.Mauny@inria.fr Organization: INRIA, BP 105, F-78153 Le Chesnay Cedex, France Phone: (+33) 1 39 63 57 96 -- Fax: (+33) 1 39 63 53 30 MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: weis Just a few more informations, following Daniel's message about quotations. First, as I said in an earlier message, macros (in the sense of Scheme) and quotations aren't exactly the same thing. Scheme-like macros provide arbitrary computations, returning values of arbitrary types. In a strongly-typed language such as ML, one must make sure that macro expansions return pieces of program, therefore a (general) implementation of macros implies some form of dynamic type-checking. On the other hand, quotations are guaranteed to return pieces of program: ML abstract syntac trees, in our previous work, and character strings in the implementation described by Daniel. In this latter implementation, the type-correctness of expanded quotations (checking that these strings represent valid pieces of program) is guaranteed by the ML parser, which raises a syntax error or accepts the expanded quotation as input. For the sake of simplicity, Daniel, in his message, considered only a simple case of usage of quotations. Quotations are indeed much more powerful that this. I won't bother you with complex examples here, but, if interested, a few interesting examples are described in a paper by Daniel and myself (reference below). In this paper, the expansion of quotations returns ML abstract syntac trees, making the system a bit more complex than when expansions return strings. Despite this small difference, the whole mechanism, together with different implementation possibilities and examples, are given in the paper. The paper is available from: ftp://ftp.inria.fr/INRIA/Projects/cristal/MLworkshop94/08-mauny.ps.Z and here is the bibtex reference: @InProceedings{Mauny-de-Rauglaudre94a, author = "Michel Mauny and Daniel de Rauglaudre", title = "A complete and realistic implementation of quotations for {ML}", booktitle = "Record of the 1994 {ACM-SIGPLAN} Workshop on {ML} and its Applications", page = "70--78", month = jun, year = 1994 } Cheers, -- Michel