From: Eric Hodel Date: 2005-05-06T12:50:37+09:00 Subject: Re: Prove me Wrong! Re: RCR 303: nil should accept missing methods On 05 May 2005, at 20:39, John Carter wrote: > On Fri, 6 May 2005, Alexey Verkhovsky wrote: > >> John Carter wrote: >> >>> A very simple and generic way of improving the reliability of Ruby >>> programs is to implement the NullObject pattern by allowing nil to >>> accept all and every method instead of throwing a NoMethodError. >> >> I, for one, would rather see it throwing an error as it is now. Dead >> programs don't tell lies. > > I would suggest next 5 times you have a nil class throws NoMethodError > crash, just add this at the head of your program... > > class NilClass > def method_missing( sym, *args) > nil > end > end I think that any RCR than can be implemented in pure ruby doesn't need to go into the core. You can place a package on RAA and get a project on RubyForge for these kinds of things handily. -- Eric Hodel - drbrain@segment7.net - http://segment7.net FEC2 57F1 D465 EB15 5D6E 7C11 332A 551C 796C 9F04