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=1.2 required=5.0 tests=AWL,DNS_FROM_AHBL_RHSBL, SPF_NEUTRAL autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from discorde.inria.fr (discorde.inria.fr [192.93.2.38]) by yquem.inria.fr (Postfix) with ESMTP id A52E5BC6B for ; Wed, 11 Jul 2007 13:28:49 +0200 (CEST) Received: from wa-out-1112.google.com (wa-out-1112.google.com [209.85.146.179]) by discorde.inria.fr (8.13.6/8.13.6) with ESMTP id l6BBSmBh029222 for ; Wed, 11 Jul 2007 13:28:49 +0200 Received: by wa-out-1112.google.com with SMTP id m34so2402574wag for ; Wed, 11 Jul 2007 04:28:48 -0700 (PDT) DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=Il0qiEzflbBX3FOtyUohU2AYC1EoIHN/d4gR+P1VMCH+mWHUwOrS0Vfq8E0yHUr9Jn43cmdBJZJH9zuma7LDhbT0W/iAijN9yS3WhP/th/LPzos1l0q0IzEtxVz53auIWg8oRrskOTgBv6H1LKvno3uK678piqn6wvPo+z4FZ4w= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=f0lzFECXI0ygRBeL6ylU8vzhmfFlwWmRYtT4nRgrlM4I0GJVQhK/PKSHX/aZnnY+aR47tJVJKDdSBlqpUiRqIqohR1qtPHzmqPQu6PQygWVMaVNBfjrfbrWR/mKPRBwI1yolSoSgozh3pl6zvp63D2xfWvt4V4Do38T/eV9mxBw= Received: by 10.114.136.1 with SMTP id j1mr5034086wad.1184153328013; Wed, 11 Jul 2007 04:28:48 -0700 (PDT) Received: by 10.114.181.9 with HTTP; Wed, 11 Jul 2007 04:28:47 -0700 (PDT) Message-ID: Date: Wed, 11 Jul 2007 13:28:47 +0200 From: "Nicolas Pouillard" To: "Sebastien Ferre" Subject: Re: [Caml-list] syntax changes from 3.08 to 3.10 Cc: caml-list@inria.fr In-Reply-To: <4694AC82.2060001@irisa.fr> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <4694AC82.2060001@irisa.fr> X-j-chkmail-Score: MSGID : 4694BEF0.000 on discorde : j-chkmail score : X : 0/20 1 0.000 -> 1 X-Miltered: at discorde with ID 4694BEF0.000 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; syntax:01 3.08:01 irisa:01 ocaml:01 3.08:01 syntax:01 ocaml:01 bool:01 camlp:01 ocamlc:01 -pp:01 bug:01 work-around:01 val:01 val:01 On 7/11/07, Sebastien Ferre wrote: > Hi, > > moving my application from OCaml 3.08 to 3.10, > I encountered 2 syntax problems, i.e. syntax errors > when compiling: > > 1. record copy and modification: > > {f x with y = 1; z = 2} > > this can be solved by parenthesizing the > evaluation of the record to be copied. > > {(f x) with y = 1; z = 2} Yes you now have to put these parentheses. > 2. object copy and modification in a method: > > {< x = 1; y = 2>} > > OCaml says the first field is a bool instead of an int, > which leads me to think it parenthesizes in the following way: > > {< x = (1; y = 2)>} > > In fact, this behaviour is only when compiling with camlp4o: > > ocamlc -pp ocamlp4o ... Yes that's an awful bug that is already fixed in CVS. > > The work-around I found to implement a copy method is as follows: > > class c = > object (self) > val x = 0 > val y = 0 > > method copy = (Oo.copy self) # copy_aux > method private copy_aux = x <- 1; y <- 2; self > end > > > Has anybody encountered the same problem ? Is there a better workaround > ? Is it a bug ? > A better workaround is: class c = object (self) val x = 0 val y = 0 method set_x newx = {< x = newx >} method set_y newy = {< y = newy >} method copy = (self#set_x 1)#set_y 2 end But this camlp4 bug is very nasty (perhaps you can try to move these calls in a file that does not require camlp4o) -- Nicolas Pouillard