utop
utop copied to clipboard
handle multiple phrases not separated by double semicolon
The following works in the normal ocaml toplevel:
# let x = 4 let y = 5;;
val x : int = 4
val y : int = 5
However, it fails in utop:
utop # let x = 4 let y = 5;;
Error: Parse error: ";;" expected after [str_item] (in [top_phrase])
Also, both disregard phrases beyond the first one:
# let x = 4;; let z = 5;;
val x : int = 4
# z;;
Error: Unbound value z
Either we should get a parse error, or preferably both phrases should be evaluated. Silently ignoring input seems wrong.
This is a camlp4 bug. It's already fixed in the camlp4 repo, I'll do a release soon. For the second part, yh, it needs to be fixed in toploop.ml IIRC.
I'm curious when the fix to this is expected to be released.
The camlp4 bugfix was released in 4.02.1+2.