Since forever ...

  # string_of_bool true;;
  - : string = "true"
  # String.blit "urgh" 0 (string_of_bool true) 0 4;;
  - : unit = ()
  # string_of_bool true;;
  - : string = "urgh"

Since OCaml 4.02 (in 2014) it has been possible to opt in to
‘-safe-string’ to make strings immutable.  You have to use the Bytes
type when you want mutable byte arrays.

In OCaml 4.06, coming to Fedora Rawhide soon, this option will be the
default and any code which mutates strings will not compile:

  # String.blit "urgh" 0 (string_of_bool true) 0 4;;
  Characters 21-42:
    String.blit "urgh" 0 (string_of_bool true) 0 4;;
                         ^^^^^^^^^^^^^^^^^^^^^
  Error: This expression has type string but an expression was expected of type
           bytes

I think most upstream packages should be fixed by now, but if you need
help to fix a particular package then file a bug and CC me on it.  As
a last resort you can enable mutable strings again using
‘-unsafe-string’, but please try not to do that.

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
Fedora Windows cross-compiler. Compile Windows programs, test, and
build Windows installers. Over 100 libraries supported.
http://fedoraproject.org/wiki/MinGW
_______________________________________________
devel mailing list -- devel@lists.fedoraproject.org
To unsubscribe send an email to devel-le...@lists.fedoraproject.org

Reply via email to