if(arr) now a warning

deadalnix via Digitalmars-d digitalmars-d at puremagic.com
Fri May 1 11:09:26 PDT 2015


On Friday, 1 May 2015 at 07:06:53 UTC, Andrei Alexandrescu wrote:
> On 4/30/15 6:12 PM, Daniel Murphy wrote:
>> "Andrei Alexandrescu"  wrote in message
>> news:mhto1k$2dk0$1 at digitalmars.com...
>>
>>> Nothing negates that. It's a judgment call. Please let's stop 
>>> here.
>>> Thanks. -- Andrei
>>
>> Please stop trying to undo this improvement.  Just fix your 
>> code and
>> move on.
>> Thanks.
>
> After we have discussed this matter extensively Walter and I 
> decided to move forward and undo this language change.
>
> It's a judgment call. The advantages and disadvantages of this 
> have been discussed extensively. We are accountable for 
> decisions like this, and we must make the decisions we believe 
> are right. That said, making a decision when there are strong 
> feelings and opinions on both sides is always difficult.
>
> We would really like to find consensus, but failing that, 
> request your indulgence.
>
> Please review: 
> https://github.com/D-Programming-Language/dmd/pull/4623
>
>
> Thanks,
>
> Andrei

You say you want to find a consensus, but neither you nor walter 
provide a good sum up of your discussion.

That makes it hard to express any good rebuttal or even be 
understanding of you position.

People here have presented situations where they faced bugs due 
to the current behavior, and even Walter got it wrong in the doc 
in the past (which makes any point saying that the current 
behavior is desirable moot).

Right now, the main reason expressed on your side is the breakage 
in std.allocator, which is known to be fairly different than your 
usual D code. It lets most people here with the feeling that 
breaking our code is no big deal (I have breakage in SDC with 
pretty much every release, usually for the better, sometime 
completely for nothing like when struct construction were not 
lvalues anymore) but breaking yours is.

It has been presented in this thread how the current behavior 
lead to confusion (including, as already mentioned, from Walter 
himself) and how unit tests is likely to NOT catch it, because it 
create this kind of situation where things mostly works, but 
really do not.

The only person here that has presented convincing evidence 
against the change is Vladimir, and that's be really interesting 
to dig into his report to know if all the reported uses are 
correct or if the change discovered some bug in his code.

Possible less painful transition path also have been proposed, 
but none has been discussed.

I sure have made the mistake myself several time and have to make 
people fix their PR because of incorrect use of slice to bool 
conversion on a regular basis, so I'd expect that this damn thing 
to be a positive change. It seems that the majority of people 
agree. Granted, it is not because most people think something 
that it makes it right, but that certainly is a good 
justification to at least provide detailed explanation of why the 
majority is wrong if it is the case.


More information about the Digitalmars-d mailing list