Version française
Home     About     Download     Resources     Contact us    
Browse thread
2 camlp4 questions
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Nicolas Pouillard <nicolas.pouillard@g...>
Subject: Re: [Caml-list] 2 camlp4 questions
On 4/5/07, Hendrik Tews <H.Tews@cs.ru.nl> wrote:
> Hi,
>
> I am still reading the camlp4 sources:
>

[... an already answered question ...]

> 2. Camlp4Bin calls a cleaning pass before printing. The cleaner
>    does things like
>
>       <:expr< $e$; $ <:expr<>> $ >> -> self#expr e
>
>    What do these empty quotations ``<:expr<>>'' stand for? Are
>    these just the things that filters leave behind if they delete
>    a node?

Yes it can be some filters junks, but not only.
If you construct something like a sequence, a tuple, a sum type
(everything that was a list before), you will often want to use some
folding style and then these nil quotations will be helpful as initial
values.

At some other points these nil quotations are not useless (and so not
removed by that cleaner phase). For instance, if there is no guard in
a match that's represented by an nil expression:

<:match_case< $p$ -> $e$ >> = <:match_case< $p$ $when:<:expr<>>$ -> $e$ >>

Cheers,

-- 
Nicolas Pouillard