From c107e00ce5346caac529f38143f2ae3620ea45cd Mon Sep 17 00:00:00 2001 From: Gabriel Scherer Date: Thu, 2 May 2019 19:24:53 +0200 Subject: [PATCH] Fix the string.mli documentation of unsafe-string (#8653) unsafe-string is no longer the default since 4.06. --- stdlib/string.mli | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/stdlib/string.mli b/stdlib/string.mli index ed5167620..a38c8123b 100644 --- a/stdlib/string.mli +++ b/stdlib/string.mli @@ -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. *)