utop icon indicating copy to clipboard operation
utop copied to clipboard

handle multiple phrases not separated by double semicolon

Open agarwal opened this issue 10 years ago • 3 comments

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.

agarwal avatar Dec 28 '14 21:12 agarwal

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.

ghost avatar Jan 07 '15 09:01 ghost

I'm curious when the fix to this is expected to be released.

yminsky avatar Feb 10 '15 12:02 yminsky

The camlp4 bugfix was released in 4.02.1+2.

ghost avatar Feb 10 '15 13:02 ghost