Forbid dynamic arrays in boolean evaluation contexts

bearophile bearophileHUGS at lycos.com
Mon Mar 25 07:28:51 PDT 2013


Daniel Murphy:

> I am in favour of deprecating/removing this, then bringing it 
> back so that
> if (arr)
> is the same as
> if (arr.length)

That was my original idea :-) And it seems a nice idea.

But turning something into a deprecation and later error is 
useful because it doesn't introduce bugs. While if you later 
assign it some other semantics, old D code will behave 
differently (despite it's probably potentially buggy code in the 
first place).

So it's a matter of how much you want to break old D code.

Bye,
bearophile


More information about the Digitalmars-d mailing list