Version française
Home     About     Download     Resources     Contact us    
Browse thread
camlp4 scope issue
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Dmitri Boulytchev <db@t...>
Subject: Re: [Caml-list] camlp4 scope issue
    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?
>