Please vote once and for good: range operations

Steven Schveighoffer schveiguy at yahoo.com
Thu Jan 29 18:17:50 PST 2009


"Daniel Keep" wrote
>
>
> Steven Schveighoffer wrote:
>> "Daniel Keep" wrote
>>> Ideally, I'd like to change all the names for the interface to be:
>>>
>>>  front -- first element in the range
>>>  back -- last element in the range
>>>  advanceFront  -- advance the front element by one
>>>  retreatBack   -- retreat the back element by one
>>>
>>> And, tempting fate...
>>>
>>>  nonEmpty -- as Walter one espoused: negative = bad, positive = good :D
>>
>> That has a negative term right in it "non".  Why do people consider empty 
>> to
>> be negative?  It's actually zero :P
>>
>> -Steve
>
> Well, if someone were to call you "empty-headed" in an outrageous French
> accent, you wouldn't be too happy about that, would you? :D

I'd probably wait until they taunt me a second time, then sneek into their 
house inside a large wooden rabbit (which unbeknownst to them would be 
nonEmpty!)

>
> The only positive form of "empty" I can think of is "empty pit of
> snakes," much preferable to any alternatives.

Empty bathroom stall
Empty trash
Empty parking space

There's all kinds of "good" empties :)  Of course, I think when one thinks 
of avoiding negatives in programming, it's not to make us all feel more 
positive joy about our code, I think it's to avoid using terms that are 
negators like notDone, or nonEmpty.  The reason being that it looks and 
reads weird when you see !notDone.  Whereas, if it's just done, then you can 
have done or !done, and both read fine.

As for empty, you could use "done" or "hasNext" or whatever, but as far as 
I'm concerned, these are nitpicks.  empty and !empty describe the situation 
perfectly and read fine.

-Steve 





More information about the Digitalmars-d mailing list