diff options
Diffstat (limited to 'stdlib/string.mli')
-rw-r--r-- | stdlib/string.mli | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/stdlib/string.mli b/stdlib/string.mli index 501fb181c..ae1ed6f91 100644 --- a/stdlib/string.mli +++ b/stdlib/string.mli @@ -25,6 +25,24 @@ Two parameters [start] and [len] are said to designate a valid substring of [s] if [len >= 0] and [start] and [start+len] are valid positions in [s]. + + One should be aware that string constants are shared: + + {[ + + # let f () = "foo";; + val f : unit -> string = <fun> + # (f ()).[0] <- 'b';; + - : unit = () + # f ();; + - : string = "boo" + + ]} + + Many functions from the standard library may return string constants. + Users should use [String.copy] to make sure they are not modifying a + shared string constant. + *) external length : string -> int = "%string_length" |