Fix the string.mli documentation of unsafe-string (#8653)

unsafe-string is no longer the default since 4.06.
master
Gabriel Scherer 2019-05-02 19:24:53 +02:00 committed by Xavier Leroy
parent 2cdf149e32
commit c107e00ce5
1 changed files with 12 additions and 14 deletions

View File

@ -32,21 +32,19 @@
substring of [s] if [len >= 0] and [start] and [start+len] are
valid positions in [s].
OCaml strings used to be modifiable in place, for instance via the
{!String.set} and {!String.blit} functions described below. This
usage is deprecated and only possible when the compiler is put in
"unsafe-string" mode by giving the [-unsafe-string] command-line
option (which is currently the default for reasons of backward
compatibility). This is done by making the types [string] and
[bytes] (see module {!Bytes}) interchangeable so that functions
expecting byte sequences can also accept strings as arguments and
modify them.
Note: OCaml strings used to be modifiable in place, for instance via
the {!String.set} and {!String.blit} functions described below. This
usage is only possible when the compiler is put in "unsafe-string"
mode by giving the [-unsafe-string] command-line option. This
compatibility mode makes the types [string] and [bytes] (see module
{!Bytes}) interchangeable so that functions expecting byte sequences
can also accept strings as arguments and modify them.
All new code should avoid this feature and be compiled with the
[-safe-string] command-line option to enforce the separation between
the types [string] and [bytes].
*)
The distinction between [bytes] and [string] was introduced in OCaml
4.02, and the "unsafe-string" compatibility mode was the default
until OCaml 4.05. Starting with 4.06, the compatibility mode is
opt-in; we intend to remove the option in the future.
*)
external length : string -> int = "%string_length"
(** Return the length (number of characters) of the given string. *)