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 _______________________________________________ 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