Version française
Home     About     Download     Resources     Contact us    
Browse thread
3.10+beta: Camlp4: AST mapping treats record labels as patterns; should they have type ident instead?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Aleksey Nogin <nogin@m...>
Subject: 3.10+beta: Camlp4: AST mapping treats record labels as patterns; should they have type ident instead?
Currently Camlp4 AST defines the record patterns as

   PaRec of loc and list (patt * patt)

and record expressions as

   ExRec of Loc.t and binding and expr

where the binding can bind arbitrary patterns to expressions. This was 
not a big issue prior to 3.10, but now that 3.10 provides very powerful 
mapping and folding features, this seems a bit problematic. Namely, if I 
define a Camlp4 filter or an AST mapping function that affects patterns, 
the array labels will get affected as well, often in an undesired way.

Would it be better to have
   PaRec of loc and list (ident * patt)
and
   ExRec of loc and list (ident * expr) and expr
instead?

If so, it would seem that now is the time to make the change, as 3.10 is 
about to make major backwards-incompatible camlp4 changes anyway.

Aleksey

P.S. I've also filed this as http://caml.inria.fr/mantis/view.php?id=4263