Copy a string: Difference between revisions
Content added Content deleted
Line 1,567: | Line 1,567: | ||
<br/> |
<br/> |
||
Between 4.02 and 4.06 (2017), immutable strings were optionally enabled via a flag: <code>-safe-string</code>. A <code>Bytes</code> module was added to provide safe and unsafe mutable views on strings. The two modules were synonymous unless the aforementioned flag was added. |
Between 4.02 and 4.06 (2017), immutable strings were optionally enabled via a flag: <code>-safe-string</code>. A <code>Bytes</code> module was added to provide safe and unsafe mutable views on strings. The two modules were synonymous unless the aforementioned flag was added. |
||
<lang ocaml>(* |
<lang ocaml>(* Transition-period synonymy between types, explicit type annotations are just for emphasis *) |
||
let dst1 : string = Bytes.copy (src : bytes) |
let dst1 : string = Bytes.copy (src : bytes) |
||
let dst2 : bytes = Bytes.copy (src : string) |
let dst2 : bytes = Bytes.copy (src : string) |