ocaml-community/utop

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

cuihtlauac opened this issue · 4 comments

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 # 

What was the resolution?

It's not a bug.

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.

# let rec f x = f x in f 42
  print_endline "42";;

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