It is the year 2020: why should I use / learn D?

Steven Schveighoffer schveiguy at gmail.com
Sat Nov 24 15:25:23 UTC 2018


On 11/23/18 6:49 PM, Walter Bright wrote:
> On 11/23/2018 4:59 AM, Chris wrote:
>> Then there was the whole issue of string handling and autodecode and 
>> the way the leadership / big guys in the community dealt with it. I 
>> was of the opinion that such an essential issue had to be fixed 
>> immediately (of course with a proper path to fix it). I even offered 
>> to be the guinea pig and document the transition. But no.
>>
>> Then there were the dreaded dmd updates. "Shit, what will break now?" 
>> this question would be my constant companion.
> Fixing autodecode will break about everything. But you don't like 
> breaking changes.
> 
> What do you suggest?

In fact, fixing autodecode will break very little. It will break some 
things, and I shudder to think of possible "correct" deprecation paths. 
But for the most part, code only cares about strings, and not the 
individual items inside them.

1. foreach(x; someString) stays the same. In fact it gets better, 
because it will be more consistent with phobos
2. someString.front changes, breaking some code, but most of it is 
already written to deal with it. Take for example std.algorithm.splitter 
-- there are already cases to handle ranges of char, it will just move 
from auto-decoding to... intentional decoding.
3. Probably the WORST part is that char implicitly casts to dchar, so 
things that expect dchar will still compile with strings whose element 
types switch to char, but instead of decoding, it will promote. Where 
you will find problems is where code assumes char[].front is dchar 
instead of using the Phobos ElementType in constraints.
4. The longer we wait, the worse it will be.

There is no way to fix autodecoding without breaking code. So we have to 
make that sacrifice to make progress. The most painful thing I think 
would be a possible deprecation path where you have to be explicit about 
how you want things decoded in order to avoid messages.

-Steve


More information about the Digitalmars-d mailing list