Creeping Bloat in Phobos

Walter Bright via Digitalmars-d digitalmars-d at puremagic.com
Sun Sep 28 12:38:25 PDT 2014


On 9/28/2014 11:39 AM, bearophile wrote:
> Walter Bright:
>
>> I'm painfully aware of what a large change removing autodecoding is. That
>> means it'll take a long time to do it. In the meantime, we can stop adding new
>> code to Phobos that does autodecoding. We have taken the first step by adding
>> the .byDchar and .byCodeUnit adapters.
>
> We have .representation and .assumeUTF, I am using it to avoid most autodecoding
> problems. Have you tried to use them in your D code?

Yes. They don't work. Well, technically they do "work", but your code gets 
filled with explicit casts, which is awful.

The problem is the "representation" of char[] is type char, not type ubyte.


> The changes you propose seem able to break almost every D program I have written
> (most or all code that uses strings with Phobos ranges/algorithms, and I use
> them everywhere). Compared to this change, disallowing comma operator to
> implement nice built-in tuples will cause nearly no breakage in my code (I have
> done a small analysis of the damages caused by disallowing the tuple operator in
> my code). It sounds like a change fit for a D3 language, even more than the
> introduction of reference counting. I think this change will cause some people
> to permanently stop using D.

It's quite possible we will be unable to make this change. But the question that 
started all this would be what would I change if breaking code was allowed.

I suggest that in the future write code that is explicit about the intention - 
by character or by decoded character - by using adapters .byChar or .byDchar.



More information about the Digitalmars-d mailing list