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.8 required=5.0 tests=AWL,DNS_FROM_RFC_POST, 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 mail1-relais-roc.national.inria.fr (mail1-relais-roc.national.inria.fr [192.134.164.82]) by yquem.inria.fr (Postfix) with ESMTP id 91CB7BBAF for ; Fri, 27 Mar 2009 10:46:17 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AtgBAHM9zEnRVdq0kGdsb2JhbACVQT8BAQEBCQkMBxEDpxiBB49NAQMBA4N0Bg X-IronPort-AV: E=Sophos;i="4.38,431,1233529200"; d="scan'208";a="26439058" Received: from mail-bw0-f180.google.com ([209.85.218.180]) by mail1-smtp-roc.national.inria.fr with ESMTP; 27 Mar 2009 10:46:17 +0100 Received: by bwz28 with SMTP id 28so848155bwz.9 for ; Fri, 27 Mar 2009 02:46:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:content-type:cc:subject:from :to:references:in-reply-to:date:message-id:user-agent; bh=fHKU4y2vb/416Bw0k6KPW4Zx9aKj3det40e+BWc8Ppc=; b=sMbgGaR8BM64TpFhyNPPrFkfoeutUocKMIYePZHvACNjzbkrHzoY/q1RgABMtaoD4M 7WZY93kXw/Uh6TBw4Pr/g5sTKU1qwyHx1j+jzsJL7anvfQ+JRi/rOrswZi76HHd5kHZc 5juMyxDdaKZt1s1djWM9oV5mvgWITDm8PMTNU= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=content-type:cc:subject:from:to:references:in-reply-to:date :message-id:user-agent; b=bx+wa1zhiTwmAwiywfssniz8f0kDJWyCLTEgnIkQgqFlZgqoI1EEr/iMtSey8vcTQq hNoGyH4aMJoxK5iB6akuue9RB9eahrpqUJqB76ABZhcz8lYdKojGRDnnoCfXtGqcDHwb kEKBeomd3F593uc/mvcE7DyDuPrtZEEqVNKBo= Received: by 10.103.173.15 with SMTP id a15mr335076mup.59.1238147176948; Fri, 27 Mar 2009 02:46:16 -0700 (PDT) Received: from localhost (ausone.inria.fr [128.93.8.95]) by mx.google.com with ESMTPS id e8sm2642665muf.18.2009.03.27.02.46.15 (version=TLSv1/SSLv3 cipher=RC4-MD5); Fri, 27 Mar 2009 02:46:16 -0700 (PDT) Content-Type: text/plain; charset=UTF-8 Cc: caml-list Subject: Re: [Caml-list] Revised syntax scope (3.10 vs. 3.11) From: Nicolas Pouillard To: Andre Nathan References: <1238128954.6000.21.camel@homesick> In-Reply-To: <1238128954.6000.21.camel@homesick> Date: Fri, 27 Mar 2009 10:45:06 +0100 Message-Id: <1238147023-sup-5902@ausone.inria.fr> User-Agent: Sup/git X-Spam: no; 0.00; syntax:01 ocaml:01 expr:01 foo:01 endline:01 endline:01 camlp:01 foo:01 syntax:01 expr:01 semicolon:01 2009:98 caml-list:01 revised:02 binding:02 Excerpts from Andre Nathan's message of Fri Mar 27 05:42:34 +0100 2009: > Hello > > I've found the following difference of behavior between OCaml 3.10 and > 3.11. The code below > > <:expr< > do { > let a = "foo" in > print_endline a; > print_endline a > } > >> > > when run through camlp4o becomes, in 3.10, > > let a = "foo" in (print_endline a; print_endline a) > > while in 3.11 it becomes > > ((let a = "foo" in print_endline a); print_endline a) > > which causes `a' to become out of scope in the second print_endline. > Is the behavior of 3.11 the correct one? I had to move the binding > of `a' out of the do block so that this works in both versions. That was indeed the intended behavior, to get a larger scope for 'a' use this syntax: <:expr< do { let a = "foo"; (* <--- semicolon here *) print_endline a; print_endline a } >> -- Nicolas Pouillard