I'm rather welcoming of the immutable change (hehe) of strings, but I haven't
considered these details -- perhaps because I only use strings as immutable
(currently with no such guarantee!), and use bigarray for a block of mutable
bytes... which is your idea #3.
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?
When I consider possible scenarios of utf8 encoded strings, 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. ;)