Am Freitag, den 04.07.2014, 14:31 -0600 schrieb Anthony Tavener: > It seems the "bytes" type would be most useful in cases where mutable > and > immutable strings are used in a mixed manner... but given these > practical > issues you raise, it could be less pleasant than it first appears. > Your > "stringlike" solution seems reasonable, but I don't have a good > use-case in > mind for mixed mutable/immutable to help me imagine the result. What > are some > scenarios where this mix of types is desired? I think even Rust > doesn't > support mutable strings -- which seems bold for its target audience, > yet > they're fine with it? I've mostly buffers in mind, as you need them for block-by-block I/O. Actually, I started thinking about this issue when looking again at OCamlnet, and how I could use "bytes" there. It's a hard case, lots of buffers of different types, and you really run into the problems I sketched in the article, as it is a common operation to copy the contents of one buffer into the other. That's also why I'm suggesting to use bigarrays - for interfacing with C these are much easier to use as buffers, as bigarrays are just malloc'ed memory and cannot be moved around by the GC. (And the C interface is needed for I/O.) So my scenario is quite low-level: I/O, and C interfaces. > When I consider possible scenarios of utf8 encoded strings, No, that's a no-go, of course. When it comes to real text, mutability doesn't give you much. Gerd > and mutating that > in-place... ugh. Even "back in the day", doing string operations in C > on > ASCII, I'd favor building a new string rather than flirting with > saving ops by > overwriting values in the current string. Oh! Upper/lower-case! Maybe > that's > the one good use-case. ;) > > > > > On Fri, Jul 4, 2014 at 1:18 PM, Gerd Stolpmann > wrote: > Hi list, > > I've just posted a blog article where I criticize the new > concept of > immutable strings that will be available in OCaml 4.02 (as > option): > > http://blog.camlcity.org/blog/bytes1.html > > In short my point is that it the new concept is not far > reaching enough, > and will even have negative impact on the code quality when it > is not > improved. I also present three ideas how to improve it. > > Gerd > -- > ------------------------------------------------------------ > Gerd Stolpmann, Darmstadt, Germany gerd@gerd-stolpmann.de > My OCaml site: http://www.camlcity.org > Contact details: http://www.camlcity.org/contact.html > Company homepage: http://www.gerd-stolpmann.de > ------------------------------------------------------------ > > > > -- > Caml-list mailing list. Subscription management and archives: > https://sympa.inria.fr/sympa/arc/caml-list > Beginner's list: http://groups.yahoo.com/group/ocaml_beginners > Bug reports: http://caml.inria.fr/bin/caml-bugs > > -- ------------------------------------------------------------ Gerd Stolpmann, Darmstadt, Germany gerd@gerd-stolpmann.de My OCaml site: http://www.camlcity.org Contact details: http://www.camlcity.org/contact.html Company homepage: http://www.gerd-stolpmann.de ------------------------------------------------------------