ocaml-community / utop

Universal toplevel for OCaml
Other
833 stars 110 forks source link

Difference between utop & ocaml w.r.t. double semicolumn #453

Open cuihtlauac opened 11 months ago

cuihtlauac commented 11 months ago

Here are an ocaml session and an utop session back to back. I believe the difference in output is a bug. Sorry for the noise if it isn't.

$ ocaml
OCaml version 5.0.0
Enter #help;; for help.

# let () = print_string "foo"
  let () = print_string "bar"
  let () = flush_all ();;
foobar#
$ utop
────────┬─────────────────────────────────────────────────────────────┬─────────
        │ Welcome to utop version 2.13.1 (using OCaml version 5.0.0)! │         
        └─────────────────────────────────────────────────────────────┘         
Type #utop_help for help about using utop.

─( 14:27:54 )─< command 0 >──────────────────────────────────────{ counter: 0 }─
utop # let () = print_string "foo"
       let () = print_string "bar"
       let () = flush_all ();;
─( 14:27:54 )─< command 1 >──────────────────────────────────────{ counter: 0 }─
utop # 
emillon commented 11 months ago

What was the resolution?

cuihtlauac commented 11 months ago

It's not a bug.

cuihtlauac commented 11 months ago

Sorry, in the first version of this report, I wasn't flushing. I thought it was allowed to lose the output because flush was not called. With an added call to flush I believe, again, that there is a bug.

cuihtlauac commented 11 months ago
# let rec f x = f x in f 42
  print_endline "42";;

To me, this suggests the output is lost in the first example