Making all strings UTF ranges has some risk of WTF

bearophile bearophileHUGS at lycos.com
Thu Feb 4 05:31:53 PST 2010


> The String structs can cache inside themselves the length and hash value the first time such
> values are computed (so each String is a struct 4 words long).

So it's not really immutable. It contains an immutable dynamic array that can be called "str", plus two mutable words.
To access the underlying 8/16/32 bit units it's composed you can use the [] of the str attribute:
"foo".str[i]

Bye,
bearophile



More information about the Digitalmars-d mailing list