if(arr) now a warning

Steven Schveighoffer via Digitalmars-d digitalmars-d at puremagic.com
Fri Apr 10 10:26:47 PDT 2015


On 4/10/15 10:53 AM, Andre Kostur wrote:
> 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."
>

empty means having nothing. In other words, if something is not empty, 
it doesn't have nothing in it.

It's the way I see it anyway. When I want to check for the presence of 
something, I don't want to say it by checking for the lack of nothing.

There, I'm confused now :)

-Steve


More information about the Digitalmars-d mailing list