From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id DAA03553; Mon, 14 Jan 2002 03:02:03 +0100 (MET) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id DAA03873 for ; Mon, 14 Jan 2002 03:02:01 +0100 (MET) Received: from c007.snv.cp.net (c007-h008.c007.snv.cp.net [209.228.33.214]) by nez-perce.inria.fr (8.11.1/8.11.1) with SMTP id g0E21tT00502 for ; Mon, 14 Jan 2002 03:01:55 +0100 (MET) Received: (cpmta 935 invoked from network); 13 Jan 2002 18:01:54 -0800 Received: from 65.187.194.217 (HELO vaiobambino) by smtp.directvinternet.com (209.228.33.214) with SMTP; 13 Jan 2002 18:01:54 -0800 X-Sent: 14 Jan 2002 02:01:54 GMT From: "Jeff Henrikson" To: "Daniel de Rauglaudre" Cc: Subject: RE: [Caml-list] camlp4: LIST1 construct on record patterns Date: Sun, 13 Jan 2002 21:17:40 -0500 Message-ID: <005501c19ca1$a4b249e0$0b01a8c0@mit.edu> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook 8.5, Build 4.71.2173.0 Importance: Normal X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2615.200 In-Reply-To: <20020113144823.E24240@verdot.inria.fr> Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk I actually tried magicing it into what I wanted it to be before, but was unable to guess it's real type. Apparently I still can't: open Printf;; let try_extend _ = let cons = "Bogus" in let lbl_expr_list = (Obj.magic (Grammar.Entry.find expr "lbl_expr_list") : (MLast.patt * MLast.expr) (* not list *) Grammar.Entry.e) in EXTEND expr: LEVEL "simple" [ [ $cons$; "{"; memb = LIST1 lbl_expr_list SEP ";" ; "}" -> <:expr<{$list:memb$}>> ] ] ; END;; try_extend 7;; Bogus{foo="happy";bar="sad"};; This segfaults. Let's see if memb is even a list: let try_extend _ = let cons = "Bogus" in let lbl_expr_list = (Obj.magic (Grammar.Entry.find expr "lbl_expr_list") : (MLast.patt * MLast.expr) (* not list *) Grammar.Entry.e) in EXTEND expr: LEVEL "simple" [ [ $cons$; "{"; memb = LIST1 lbl_expr_list SEP ";" ; "}" -> (printf "Do we get here %d\n" (List.length memb); flush stdout; <:expr<6>>) ] ] ; END;; try_extend 7;; Bogus{foo="happy";bar="sad"};; This prints "Do we get here 1", regardless of how many terms I add in Bogus{}, regardless of whether such constructors are defined or not. But despite all this the source code looks convincing enough: pa_o.ml: | "{"; test_label_eq; lel = lbl_expr_list; "}" -> <:expr< { $list:lel$ } >> > Sorry, Luke, you entered the dark side of Camlp4... :-) Apparently the force is not strong enough within me. ;-} Jeff ------------------- Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr