On 4/24/2015 11:52 AM, H. S. Teoh via Digitalmars-d wrote:
I really wish we would just *make the darn decision* already, whether to
kill off autodecoding or not, and MAKE IT CONSISTENT ACROSS PHOBOS,
instead of introducing this schizophrenic dichotomy where some functions
give you a range of dchar while others give you a range of char/wchar,
and the two don't work well together. This is totally going to make a
laughing stock of D one day.

Some facts:

1. When I started D, there was a lot of speculation about whether the world would settle on UTF8, UTF16, or UTF32. So D supports natively all three. Time has shown, however, that UTF8 has pretty much won. wchar only exists for Windows API and Java, dchar strings pretty much don't exist in the wild.

2. dchar is very useful as a character type, but not as a string type.

3. Pretty much none of the algorithms in Phobos work when presented with a range of chars or wchars. This is not even documented.

4. Autodecoding is inefficient, especially considering that few algorithms actually need decoding. Re-encoding the result back to UTF8 is another inefficiency.

I'm afraid we are stuck with autodecoding, as taking it out may be far too disruptive.

But all is not lost. The Phobos algorithms can all be fixed to not care about autodecoding. The changes I've made to std.string all reflect that.

https://github.com/D-Programming-Language/phobos/pulls/WalterBright

Reply via email to