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=2.0 required=5.0 tests=DATE_IN_FUTURE_03_06 autolearn=disabled version=3.1.3 Received: from discorde.inria.fr (discorde.inria.fr [192.93.2.38]) by yquem.inria.fr (Postfix) with ESMTP id E9592BC68 for ; Wed, 25 Oct 2006 17:42:05 +0200 (CEST) Received: from mail.tepkom.ru (mail-ilca.tepkom.ru [82.179.167.5]) by discorde.inria.fr (8.13.6/8.13.6) with ESMTP id k9PFg5kJ022270 for ; Wed, 25 Oct 2006 17:42:05 +0200 Received: from localhost (localhost [127.0.0.1]) by mail.tepkom.ru (Postfix) with ESMTP id D3FA1580C64F; Wed, 25 Oct 2006 19:41:44 +0400 (MSD) X-Virus-Scanned: by amavisd-new-2.4.0 (20060403) (Debian) at tepkom.ru with clamav Received: from mail.tepkom.ru ([127.0.0.1]) by localhost (mail.tepkom.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Y8H10429AcRW; Wed, 25 Oct 2006 19:41:44 +0400 (MSD) Received: from [192.168.1.4] (pppoe-93.7.110.89-adsl.spbnit.ru [89.110.7.93]) by mail.tepkom.ru (Postfix) with ESMTP id 10A07580C6BF; Wed, 25 Oct 2006 19:41:41 +0400 (MSD) Message-ID: <453FBE38.3030602@tepkom.ru> Date: Wed, 25 Oct 2006 19:42:48 +0000 From: Dmitri Boulytchev User-Agent: Mozilla Thunderbird 1.0.6 (X11/20050905) X-Accept-Language: ru-ru, ru MIME-Version: 1.0 To: Serge Aleynikov Cc: caml-list@inria.fr Subject: Re: [Caml-list] camlp4 scope issue References: <453F8464.3000808@hq.idt.net> In-Reply-To: <453F8464.3000808@hq.idt.net> Content-Type: text/plain; charset=windows-1251 Content-Transfer-Encoding: 7bit X-Miltered: at discorde with ID 453F85CD.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; camlp:01 semicolon:01 printf:01 printf:01 compiler:01 ocamlc:01 -pp:01 camlp:01 caml-list:01 binary:01 tepkom:02 scope:03 scope:03 let:03 let:03 That's ok - semicolon does not restict the scope since it plays role of a binary operation, not a statement delimiter. So in your example (); Printf.printf "y should be out of scope, but it's not: y = %d\n" y is a while scope for let-binding. Best regards, Dmitri Boulytchev, St.Petersburg State University. > Hi, > > In the test program below in my understanding the 'y' variable should be > out of scope in the printf statement, but apparently it's not. The > compiler version is 3.09.3. > > $ cat tst.ml > value f z = z + 1; > > let x = 1 in do { > let y = f x in (); > Printf.printf "y should be out of scope, but it's not: y = %d\n" y > }; > > $ ocamlc -o tst -pp camlp4r tst.ml > $ ./tst > y should be out of scope, but it's not: y = 2 > > > Any idea why? >