Forbid dynamic arrays in boolean evaluation contexts
Daniel Murphy
yebblies at nospamgmail.com
Tue Mar 26 07:19:56 PDT 2013
"bearophile" <bearophileHUGS at lycos.com> wrote in message
news:fqjmqdhpenxnfadxwgbx at forum.dlang.org...
> 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
The deprecation process is long and slow, so when it finally finishes the
error stage we can evaluate how much legacy code we risk breaking. Even if
we never bring in the new meaning removing it will improve the language.
More information about the Digitalmars-d
mailing list