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 And see what happens. If, your program then works correctly, then I am right. If, your still program thows an exception or reports an error, but perhaps a slightly different point, then I am still right, namely this change doesn't hide bugs. If the program silent proceeds to do the wrong thing, then I am wrong. I ask members of this list to actually try this experiment the next couple of times they hit a nil throws NoMethodError and send the results to me. I will summarize to the list. If I prove wrong, I will gladly retract my RCR and apologise. 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 This rock is covered by a very very thin layer of life. (Think 6000km of rock followed by a meter or so of biomass.)