string is rarely useful as a function argument

Walter Bright newshound2 at digitalmars.com
Wed Dec 28 23:04:48 PST 2011


On 12/28/2011 10:33 PM, Jakob Ovrum wrote:
> I don't think this is a problem you can solve without educating people. They
> will need to know a thing or two about how UTF works to know the performance
> implications of many of the "safe" ways to handle UTF strings. Further, for much
> use of Unicode strings in D you can't get away with not knowing anything anyway
> because D only abstracts up to code points, not graphemes. Imagine trying to
> explain to the unknowing programmer what is going on when an algorithm function
> broke his grapheme and he doesn't know the first thing about Unicode.
>
> I'm not claiming to be an expert myself, but I believe D offers Unicode the
> right way as it is.

I think this goes to, at some point, the language is no longer able to hide the 
realities of the underlying machine. This happens with floating point (they are 
NOT mathematical real numbers), integers (they overflow), etc.

Keep in mind that D already has a string type where the code points match the 
characters:

      dstring[]


More information about the Digitalmars-d mailing list