Version française
Home     About     Download     Resources     Contact us    
Browse thread
Upgrading sexplib-2.7.0 to camlp4 3.10
[ 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: Upgrading sexplib-2.7.0 to camlp4 3.10
On 4/30/07, Joel Reymont <joelr1@gmail.com> wrote:
> This replacement compiles.
>
> Should I assume it to be correct?
>
> let tuplify_exprs _loc = function
>    | [] -> assert false
>    | [expr] -> expr
>    | exprs -> <:expr< ( exprs ) >>

No that one is not correct your are building the program with the free
variable `exprs'.

The correct code should be:

| expr :: exprs -> <:expr< ( $expr$, $list:exprs$ ) >>

Which is a sugar for:

| expr :: exprs -> <:expr< ( $expr$, $Ast.exCom_of_list exprs$ ) >>

Alas camlp4of seems to don't support that sugar well, so fall back the
second one.

-- 
Nicolas Pouillard