syntaxocamlstring-literals

Where is OCaml's alternative string syntax {|...|} documented?


OCaml's syntax for string literals

let s = "..."

is explained in the manual at the expected position:

https://caml.inria.fr/pub/docs/manual-ocaml/lex.html#s:stringliteral

However, OCaml has an alternative syntax for string literals which is especially handy for regular expressions and multi-line strings:

let s = {|...|}
let s = {foo|...|foo}

Where is that documented?


Solution

  • To answer this question myself, the syntax was originally described in the extensions chapter of the OCaml manual:

    Thanks to glennsl and octachron for pointing this out.

    Meanwhile it has been moved to the expected, more visible, places: