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

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Joel Reymont <joelr1@g...>
Subject: camlp4 3.10: Tuple processing
Looking at Martin's json code I find this example of tuple conversion  
in the old syntax:

       | Tuple l ->
           let tl = List.map convert l in
           <:ctyp< ( $list:tl$ ) >>

In the new syntax the same code becomes something much larger:

       | Tuple l ->
           (* (* Development version post-3.10.0+beta: *)
              let tl = List.map convert l in
              <:ctyp< ( $tup:Ast.tySta_of_list tl$ ) >> *)
           let t =
             List.fold_right
               (fun x tup -> <:ctyp< $convert x$ * $tup$ >>)
               l <:ctyp< >> in
           <:ctyp< $tup:t$ >>

What is the advantage of the new approach and how did it become so  
verbose?

	Thanks, Joel

[1] http://martin.jambon.free.fr/examples/pa_json_static_3100beta.html

--
http://wagerlabs.com/