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.8 required=5.0 tests=AWL,SPF_SOFTFAIL autolearn=disabled version=3.1.3 Received: from mail4-relais-sop.national.inria.fr (mail4-relais-sop.national.inria.fr [192.134.164.105]) by yquem.inria.fr (Postfix) with ESMTP id 9C570BB84 for ; Mon, 11 Aug 2008 18:49:28 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: ApoEAGgKoEjAXQIm/2dsb2JhbACraA X-IronPort-AV: E=Sophos;i="4.31,342,1215381600"; d="scan'208";a="28142434" Received: from discorde.inria.fr ([192.93.2.38]) by mail4-smtp-sop.national.inria.fr with ESMTP; 11 Aug 2008 18:49:28 +0200 Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by discorde.inria.fr (8.13.6/8.13.6) with ESMTP id m7BGnQtu023464 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=OK) for ; Mon, 11 Aug 2008 18:49:28 +0200 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: ApoEACYKoEhQRFuw/2dsb2JhbACrZA X-IronPort-AV: E=Sophos;i="4.31,342,1215381600"; d="scan'208";a="15915026" Received: from furbychan.cocan.org ([80.68.91.176]) by mail3-smtp-sop.national.inria.fr with ESMTP/TLS/AES256-SHA; 11 Aug 2008 18:49:26 +0200 Received: from rich by furbychan.cocan.org with local (Exim 4.63) (envelope-from ) id 1KSaaD-0004dU-2a for caml-list@inria.fr; Mon, 11 Aug 2008 17:49:25 +0100 Date: Mon, 11 Aug 2008 17:49:25 +0100 To: caml-list@inria.fr Subject: camlp4: How to make a record expression w/o useless "with" Message-ID: <20080811164924.GA17563@annexia.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.13 (2006-08-11) From: Richard Jones X-Miltered: at discorde with ID 48A06D96.000 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; camlp:01 camlp:01 ocaml:01 syntax:01 bug:01 ocaml:01 syntax:01 foo:01 baz:01 quux:01 expr:01 rbs:98 rbs:98 abstract:01 rec:01 I have some code like the minimal example below. Notice the '{ () with ... }' record expression. If I remove the '() with' part, it fails to compile. Now the problem is that I'm actually using camlp4 to generate code which gets saved in an ml file. In other words I'm using 'Printers.OCaml.print_implem' to print out the final code. The useless '() with' causes a non-fatal but annoying warning (X) when the generated code is compiled later on. How can I get rid of it? According to http://brion.inria.fr/gallium/index.php/Abstract_Syntax_Tree the version without the useless '() with' ought to work, so maybe this is a camlp4 bug? This is OCaml 3.10.2. ------------------------------------------------------------ open Camlp4.PreCast open Syntax let _loc = Loc.ghost let rbs = <:rec_binding< foo = bar ; baz = quux >> let record = <:expr< { () with $rbs$ } >> ------------------------------------------------------------ Rich. -- Richard Jones Red Hat