if(arr) now a warning

Andre Kostur via Digitalmars-d digitalmars-d at puremagic.com
Fri Apr 10 07:53:24 PDT 2015


On 2015-04-10 5:42 AM, Steven Schveighoffer wrote:
>
> empty is a negative. I'd prefer if(arr.length) instead of
> if(!arr.empty), as the latter's a double-negative.

Hmm.  I've never thought of empty as a negative.  For me empty says 
"This thing has the property/state of being empty", not "this thing has 
a corresponding length (or size) of not 0".  Thus if (!arr.empty) is 
only a single negative for me.  "This thing does not have the state of 
being empty."



More information about the Digitalmars-d mailing list