From: Hal Fulton Date: 2006-10-07T08:46:13+09:00 Subject: Re: nil being empty Austin Ziegler wrote: > On 10/6/06, Trans wrote: > >> That's the best example I have yet seen. Thanks for that Ara. Yet >> there's still a problem. Your expecting a NoMethodError on nil, just >> like I said. That's the thing, there's no other possible issue involved >> here. Now I'll grant James' concern that it can make some bugs harder >> to track down, but if that's our primary concern then I suggest we get >> back to static typing. > > > If I'm expecting to call #empty? I'm expecting to call it on something > where it's meaningful. > > What is 0.empty? 1.empty? -1.empty? If I allow nil.empty? why do I not > want Fixnum#empty? > > Nil isn't empty: nil just isn't. (As someone else said, one's spoon > can't be empty if one doesn't have a spoon.) All agreed. Maybe the OP is feeling the need for a #nil_or_empty? as others sometimes have. I have felt that need, but I defined a null? that returned true for nil or an empty container. But that is just silly enough that I wouldn't release any code that did that. Hal