English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

Browse thread
Revised syntax scope (3.10 vs. 3.11)
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2009-03-27 (04:38)
From: Andre Nathan <andre@s...>
Subject: Revised syntax scope (3.10 vs. 3.11)

I've found the following difference of behavior between OCaml 3.10 and
3.11. The code below

    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.