caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Nicolas Pouillard <nicolas.pouillard@gmail.com>
To: Andre Nathan <andre@sneakymustard.com>
Cc: caml-list <caml-list@inria.fr>
Subject: Re: [Caml-list] Revised syntax scope (3.10 vs. 3.11)
Date: Fri, 27 Mar 2009 10:45:06 +0100	[thread overview]
Message-ID: <1238147023-sup-5902@ausone.inria.fr> (raw)
In-Reply-To: <1238128954.6000.21.camel@homesick>

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


  reply	other threads:[~2009-03-27  9:46 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-27  4:42 Andre Nathan
2009-03-27  9:45 ` Nicolas Pouillard [this message]
2009-03-27 14:43   ` [Caml-list] " Andre Nathan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1238147023-sup-5902@ausone.inria.fr \
    --to=nicolas.pouillard@gmail.com \
    --cc=andre@sneakymustard.com \
    --cc=caml-list@inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).