From: John Carter Date: 2005-05-06T13:35:26+09:00 Subject: Re: RCR 303: nil should accept missing methods and return nil On Fri, 6 May 2005, Austin Ziegler wrote: > But nil isn't an Anything object, it's nothing. It shouldn't respond > to things that it doesn't know about. Ah, but you're wrong, nil is "no thing, of any type, is here." > If you want nil as a null object, use a module to extend the > behaviour -- but don't be surprised if a lot of programs start dying > for unclear reasons. Prove me wrong, take the challenge. Next time your pet program dies of a NoMethodError for NilClass add class NilClass def method_missing(sym,*args) nil end end ...at the head of your program. See empirically what happens. Does it hide bugs? Does it just work? Does it still throw an exception or give an error message? Try this next few occasions you get such a bug, each time email me the results, I will summarize to the group. John Carter Phone : (64)(3) 358 6639 Tait Electronics Fax : (64)(3) 359 4632 PO Box 1645 Christchurch Email : john.carter@tait.co.nz New Zealand Somewhere on the edge of a Galaxy, one of literally billions of such galaxies, is a sun, one of literally billions of suns in that galaxy.