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.4 required=5.0 tests=AWL,DNS_FROM_RFC_ABUSE, HTML_MESSAGE,SPF_NEUTRAL autolearn=disabled version=3.1.3 Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by yquem.inria.fr (Postfix) with ESMTP id 3E8BCBC68 for ; Wed, 25 Oct 2006 18:21:08 +0200 (CEST) Received: from ug-out-1314.google.com (ug-out-1314.google.com [66.249.92.175]) by concorde.inria.fr (8.13.6/8.13.6) with ESMTP id k9PGL7f3022076 for ; Wed, 25 Oct 2006 18:21:07 +0200 Received: by ug-out-1314.google.com with SMTP id g33so124874ugd for ; Wed, 25 Oct 2006 09:21:07 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:sender:to:subject:in-reply-to:mime-version:content-type:references:x-google-sender-auth; b=ZFP8TcKnO2CY5z1HH7O7aJT5BhNuxv6lFWQ9jKA+UL7wTGjas/BrkOJfDwYqlrka2UBwgWeUxkH71/jY8cJwE2apPxrutEYoJPds8WPmXgAADIwO/jf481mb8bxT8Et3ROqBNPFYlQ02jh54BBU+rYF3U3rqqht3H/Y1TqyfHjU= Received: by 10.66.224.19 with SMTP id w19mr1136466ugg; Wed, 25 Oct 2006 09:21:06 -0700 (PDT) Received: by 10.66.221.7 with HTTP; Wed, 25 Oct 2006 09:21:06 -0700 (PDT) Message-ID: <2a1a1a0c0610250921p5a4d6b22ic146a96e1fcac51f@mail.gmail.com> Date: Wed, 25 Oct 2006 12:21:06 -0400 From: "Mike Lin" Sender: nilekim@gmail.com To: caml-list@inria.fr Subject: Re: [Caml-list] camlp4 scope issue In-Reply-To: <453FC6D5.2040404@tepkom.ru> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_35961_28413590.1161793266786" References: <453F8464.3000808@hq.idt.net> <453FBE38.3030602@tepkom.ru> <453F8AF8.4090306@hq.idt.net> <453FC6D5.2040404@tepkom.ru> X-Google-Sender-Auth: f42bd0850f114360 X-Miltered: at concorde with ID 453F8EF3.001 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; mikelin:01 camlp:01 ocaml:01 mikelin:01 ocaml:01 syntax:01 compiler:01 syntax:01 iterative:01 semicolon:01 printf:01 printf:01 compiler:01 ocamlc:01 -pp:01 ------=_Part_35961_28413590.1161793266786 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline I would like to take this opportunity to plug ocaml+twt. Relieve your suffering... http://people.csail.mit.edu/mikelin/ocaml+twt/ On 10/25/06, Dmitri Boulytchev wrote: > > The revised syntax description you are referring to is quite > informal so I'd rather trust the compiler :) > You may restict the scope of a binding in a way its usual done in > other languages: by > > do {let y = 1 in a}; b; c; > > in revised or by > > (let y = 1 in a); b; c; > > in standard syntax. > > BR, > DB. > > > Perhaps I am misunderstanding the meaning of ";" in the revised > > syntax, however, the 6.2 chapter > > (http://caml.inria.fr/pub/docs/manual-camlp4/manual007.html) says that: > > > > do { e1; e2; e3; e4 } > > > > is an iterative sequence of expressions, whereas "let ... in" is > > reserved for local constructs. > > > > If so, wouldn't the scope of y in > > > > let y = 1 in do { a; b; c }; > > > > be different from: > > > > let y = 1 in a; b; c; > > > > Or else how to we indicate in the *revised syntax* the boundary of the > > "let ... in" scope? > > > > Serge > > > > Dmitri Boulytchev wrote: > > > >> 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? > >>> > >> > >> > > > > > > _______________________________________________ > Caml-list mailing list. Subscription management: > http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list > Archives: http://caml.inria.fr > Beginner's list: http://groups.yahoo.com/group/ocaml_beginners > Bug reports: http://caml.inria.fr/bin/caml-bugs > ------=_Part_35961_28413590.1161793266786 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline I would like to take this opportunity to plug ocaml+twt. Relieve your suffering...
http://people.csail.mit.edu/mikelin/ocaml+twt/

On 10/25/06, Dmitri Boulytchev < db@tepkom.ru> wrote:
    The revised syntax description you are referring to is quite
informal so I'd rather trust the compiler :)
    You may restict the scope of a binding in a way its usual done in
other languages: by

    do {let y = 1 in a}; b; c;

    in revised or by

    (let y = 1 in a); b; c;

    in  standard syntax.

    BR,
    DB.

> Perhaps I am misunderstanding the meaning of ";" in the revised
> syntax, however, the 6.2 chapter
> ( http://caml.inria.fr/pub/docs/manual-camlp4/manual007.html) says that:
>
> do { e1; e2; e3; e4 }
>
> is an iterative sequence of expressions, whereas "let ... in" is
> reserved for local constructs.
>
> If so, wouldn't the scope of y in
>
> let y = 1 in do { a; b; c };
>
> be different from:
>
> let y = 1 in a; b; c;
>
> Or else how to we indicate in the *revised syntax* the boundary of the
> "let ... in" scope?
>
> Serge
>
> Dmitri Boulytchev wrote:
>
>>     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?
>>>
>>
>>
>
>

_______________________________________________
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs

------=_Part_35961_28413590.1161793266786--