if(arr) now a warning

Martin Nowak via Digitalmars-d digitalmars-d at puremagic.com
Fri Apr 10 03:14:42 PDT 2015


On Friday, 10 April 2015 at 09:27:56 UTC, w0rp wrote:
> If we need a deprecation path, we can do it. We just warn about 
> if (arr) for a while, so you are told to use if(arr.length == 
> 0) or if (arr.ptr is null) for a while, then we change the 
> behaviour in another release.

That's kind of the roadmap, though we'd need to wait quite a 
while until we can reuse it.
I've been thinking about moving std.array.empty to object. Then 
that could more easily become the replacement idiom.

if (arr) -> if (!arr.empty)

It's much clearer and also what you need to write when you work 
with ranges.


More information about the Digitalmars-d mailing list