From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by yquem.inria.fr (Postfix) with ESMTP id 333B7BC6B for ; Fri, 23 Mar 2007 20:02:06 +0100 (CET) Received: from out5.smtp.messagingengine.com (out5.smtp.messagingengine.com [66.111.4.29]) by concorde.inria.fr (8.13.6/8.13.6) with ESMTP id l2NJ258J001336 for ; Fri, 23 Mar 2007 20:02:05 +0100 Received: from compute2.internal (unknown [10.202.2.42]) by out1.messagingengine.com (Postfix) with ESMTP id B220720C216; Fri, 23 Mar 2007 15:02:05 -0400 (EDT) Received: from heartbeat1.messagingengine.com ([10.202.2.160]) by compute2.internal (MEProxy); Fri, 23 Mar 2007 15:02:05 -0400 X-Sasl-enc: TRv7sVasYeNulDMKVES8OVJ0q0AJYBdA648LaT/K8Kvp 1174676525 Received: from [172.16.112.115] (burnham.ljcrf.edu [192.231.106.2]) by mail.messagingengine.com (Postfix) with ESMTP id 4E3956E88; Fri, 23 Mar 2007 15:02:05 -0400 (EDT) Date: Fri, 23 Mar 2007 12:00:51 -0700 (PDT) From: Martin Jambon X-X-Sender: martin@localhost To: Nicolas Pouillard Cc: caml-list@inria.fr Subject: Re: [Caml-list] Camlp4 3.10.0+beta: lists without $list:...$ In-Reply-To: Message-ID: References: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Miltered: at concorde with ID 4604242D.002 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; ens-lyon:01 camlp:01 ens-lyon:01 camlp:01 ctyp:01 ctyp:01 syntax:01 bug:01 intentional:01 bug:01 manipulates:01 diffs:01 syntax:01 mutable:01 mutable:01 On Fri, 23 Mar 2007, Nicolas Pouillard wrote: > On 3/23/07, Martin Jambon wrote: > > I managed to create an object type using camlp4orf: > > > > let ctyp_object _loc ml = > > let fields = > > List.fold_left > > (fun o (name, typ) -> > > let m = <:ctyp< $lid:name$ : $typ$ >> in > > <:ctyp< $o$; $m$ >>) > > <:ctyp< >> ml in > > <:ctyp< < $fields$ > >> > > > > where ml is a list of method declarations of type (string * ctyp) list. > > Before we just had to do this: > > > > <:ctyp< < $list:ml$ > >> > > > > Is there anything simpler than my solution? Is a shortcut available? > > In fact there is some shortcuts but it was not for all constructions > (fixed now in CVS). ... > You can note that in `` [ $list:cases$ '' I used the $list:...$ > antiquotation that was used to inject some list in a tree. In 3.10 you > can still do that, but that's a sugar for a function call that will > join all your trees by the proper separator (bar here). > > FYI, I've just added all the missing $list:$ sugars to the CVS version > (will be public soon). Thanks. > > PS: any progress on the manual? It's kind of hard to test new features > > when you don't know what they are. > > I agree, but there is still no progress on the documentation :( > > BTW, have you read these slides > http://gallium.inria.fr/~pouillar/pub/camlp4/renovation-camlp4-longue.pdf OK, I am trying to convert my syntax extensions and everyday I hit a new problem, which by default I report as a bug because if it's not documented as an intentional incompatiblity, it must be a bug. I started with pa_json_static.ml (from http://martin.jambon.free.fr/json-static.html) because it's fairly complete and doesn't use any dirty trick. It manipulates all kinds of types, each of them as exprs, patts and ctyps. So I guess once this works, it would be a big progress toward upgrading all my stuff. I'll publish the commented diffs as soon as I get a version that works, but it would be much faster if you could do it for me. The thing is I don't really know how I can help. For now I am stuck with record type definitions: With quotations in the revised syntax (command camlp4orf), how to create a record field with an optional mutable flag? <:ctyp< $name$ : $opt:is_mutable$ $t1$ >> gives a syntax error (well, that was yesterday night and it was late and I don't have the details here, but you can check). It's only needed because the $list:...$ is not supported for building my whole record declaration, in version 3.10.0+beta that is. Thanks Martin -- Martin Jambon http://martin.jambon.free.fr