Hi -- On Sun, 5 Mar 2006, James Edward Gray II wrote: > I'm examining Kirbybase for use it a project and was surprised to find this > bit of code in it: > > #--------------------------------------------------------------------------- > # NilClass > #--------------------------------------------------------------------------- > class NilClass > > def method_missing(method_id, *stuff) > return nil > end > end > > This has been a popular discussion lately, but I just don't think loading a > database library should fundamentally change the language. ActiveRecord > doesn't hack NilClass and we seem to do okay with that. Why can't the above > example just be coded as: > > select { |r| r.speed and r.speed > 300 } > > or: > > select { |r| r.speed > 300 rescue false } Or, depending on circumstances: r.speed.to_i > 300. I would definitely steer clear of adding method_missing to nil. Tons of code, including all the Ruby code in the standard library, is written without it. I don't know how often it would matter, but the main thing is that nil behaves in an unambiguous, official way, and changing that is risky. David -- David A. Black (dblack / wobblini.net) Ruby Power and Light (http://www.rubypowerandlight.com) "Ruby for Rails" chapters now available from Manning Early Access Program! http://www.manning.com/books/black