dbuenzli / down

An OCaml toplevel (REPL) upgrade
http://erratique.ch/software/down
ISC License
81 stars 3 forks source link

down only recognizes the first top-level statement of several ones when copy-and-pasted #30

Closed aqjune closed 1 year ago

aqjune commented 1 year ago

Hi, thanks for a nice tool.

I found that down only recognizes the first statement when I copy-and-pasted several statements at once.

For example, let's assume that I copied these two lines from somewhere:

let x = 10;;
let y = 20;;

If I paste it at ocaml after #use "down.top", only x is defined, but not y.

OCaml version 4.14.0
Enter #help;; for help.

# #use "down.top";;
Down v0.1.0 loaded. Type Down.help () for more info.
# let x = 10;;
val x : int = 10
# (* where is y? *)

Thanks!

dbuenzli commented 1 year ago

Yes that's a limitation of ocaml itself see https://github.com/ocaml/ocaml/issues/8813

aqjune commented 1 year ago

Oh, I didn't realize that was the limitation of ocaml itself. I wasn't aware of it because I was using rlwrap ocaml which successfully deals with this case. I will leave a comment there.

dbuenzli commented 1 year ago

rlwrap ocaml which successfully deals with this case.

Mmmh I guess it splits on newlines and feeds it line by line. But something like pasting let x = 10;; let y = 20;; shouldn't work.

aqjune commented 1 year ago

I see, so even rlwrap isn't the complete solution yet. Will close this issue since this is ocaml's problem