Version française
Home     About     Download     Resources     Contact us    
Browse thread
Re: Quotations in Caml-Special-Light and Caml-Light
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Michel.Mauny@i...
Subject: Re: Quotations in Caml-Special-Light and Caml-Light

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