Le mercredi 11 juin 2014 à 07:02 -0700, Kevin Squire a écrit : > Actually, Strings are already immutable. Well, mostly. You can't > change a string directly, but you can (but generally shouldn't) modify > the backing array. > > > > Given that, I don't know why indexing couldn't return a substring, > although there might be reasons--e.g., calling C code is possible with > ASCIIStrings or UTF8Strings, but SubStrings have to be copied and > null-terminated (I think this already happens). Yeah, you are supposed to call bytestring() on strings you pass to C. It is a no-op for ASCIIString and UTF8String, but not for SubString, for which it creates a copy.
Regards
