if(arr) now a warning

Kagamin via Digitalmars-d digitalmars-d at puremagic.com
Fri Apr 10 03:03:33 PDT 2015


On Friday, 10 April 2015 at 09:35:44 UTC, John Colvin wrote:
> As others have mentioned, why not make if(arr) be equivalent to 
> if(arr.length)? It seems that's what everyone actually wants 
> when they type it.

Maybe after we kept if(arr) an error for some time.
Python got it right, in C# difference between null and empty 
causes only problems and nothing else. D has a particularly 
fitting slice design to get it right too.


More information about the Digitalmars-d mailing list