Re: Quotations in Caml-Special-Light and Caml-Light

Michel Mauny (Michel.Mauny@inria.fr)
Fri, 17 Nov 1995 17:29:12 +0100 (MET)

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)
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)

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