Hi --
nil is an interesting beast. In one of my projects, I added "each" to
NilClass
class NilClass
def each
end
end
so that I can treat nil returned from IO:select as if it is an empty array.
I like this change personally, and it does make sense to me logically
("doing something on each element of nothing" is equivalent to "do
nothing"),
but does it make sense to everybody? What if somebody fail to capture the
bug
because of this change?
I would definitely not make a change like that. First of all, nil
isn't composed of elements, so there's no concept of "each element" of
nil. Second, the answer to your second question is: the program will
almost certainly blow up or silently do something it isn't supposed to
do. That's what happens when you mask bugs

It's not a good idea.
David
--
Upcoming training from Ruby Power and Light, LLC:
* Intro to Ruby on Rails, Edison, NJ, October 23-26
* Advancing with Rails, Edison, NJ, November 6-9
Both taught by David A. Black.
See
http://www.rubypal.com for more info!