From: Dave Thomas Date: 2002-07-07T22:24:04+09:00 Subject: Re: Pre-RCR... nil.empty? "Christoph" writes: > Yeah, I agree whole heartedly. Following Dave's logic it makes sense > to define the all time favorites > > nil#each (do nothing - very useful for tree stuff) > > or even > > nil#collect (returning the empty Array) Of course, nil.to_a already returns [], so nil#each arguably _should_ iterate zero times to be consistent with itself, and once you have an #each, why not include Enumerable...? To my mind it isn't a question of what nil is as much as a question of pragmatics. If I find myself performing the same double-barreled test using nil and something else, I ask myself if maybe the behavior of nil could be improved. It's a bit like the story of laying out the paths in the newly constructed campus. The architect said "don't lay any concrete paths. Just cover all the area between the buildings with grass." A year later, the grass had worn to show where people actually walked, and that's where they then poured the paths. I'm suggesting that is an idiom is common enough we should perhaps consider setting it in concrete. Cheers Dave