Truncated display in OCaml 4.06

Since I switched to OCaml 4.06, I noticed that in the toplevel the string display is now “truncated”. So far I don’t see what use such a feature has, and I find the following to be rather a waste of space in the terminal

“ocamlc -bin-ann”… (* string length 272; truncated );
“mv /Users/Jona”… (
string length 148; truncated );
“ocamlc -bin-”… (
string length 178; truncated );
“mv /Users/Jo”… (
string length 122; truncated );
“ocamlc -bin”… (
string length 220; truncated );
“mv /Users/”… (
string length 122; truncated );
“ocamlc -”… (
string length 152; truncated );
“mv /User”… (
string length 158; truncated );
"ocamlc "… (
string length 285; truncated );
“mv /Us”… (
string length 158; truncated );
“ocaml”… (
string length 181; truncated );
“mv /”… (
string length 149; truncated );
“oca”… (
string length 267; truncated );
“mv”… (
string length 149; truncated );
“o”… (
string length 172; truncated );
“”… (
string length 142; truncated *); …]

Are there buitlins (or perhaps simple functions I could write) to display strings or string lists the old way ?

One option is to the use #print_length directive.

utop [13]: #print_length 10;;
utop [14]: let s = String.init 100 (fun _ -> 'x');;
val s : string = "xxxxxxxxx"... (* string length 100; truncated *)
utop [16]: let s = String.init 100 (fun _ -> 'x');;
val s : string =
  "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
2 Likes