utop icon indicating copy to clipboard operation
utop copied to clipboard

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

Open cuihtlauac opened this issue 2 years ago • 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 # 

cuihtlauac avatar Jul 31 '23 12:07 cuihtlauac

What was the resolution?

emillon avatar Jul 31 '23 14:07 emillon

It's not a bug.

cuihtlauac avatar Jul 31 '23 14:07 cuihtlauac

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 avatar Aug 02 '23 15:08 cuihtlauac

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

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

cuihtlauac avatar Aug 04 '23 09:08 cuihtlauac