FYI: OCaml 4.06 in Fedora 28 will change default mutability of strings

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to devel-leave@xxxxxxxxxxxxxxxxxxxxxxx




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Fedora Announce]     [Fedora Kernel]     [Fedora Testing]     [Fedora Formulas]     [Fedora PHP Devel]     [Kernel Development]     [Fedora Legacy]     [Fedora Maintainers]     [Fedora Desktop]     [PAM]     [Red Hat Development]     [Gimp]     [Yosemite News]
  Powered by Linux