From: Austin Ziegler Date: 2005-05-07T02:28:25+09:00 Subject: Re: Prove me Wrong! Re: RCR 303: nil should accept missing methods On 5/5/05, 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... No. I can tell you from experience over the last four days that I have fixed no fewer than five *real* bugs in PDF::Writer that would have resulted in the incorrect generation of PDF output had I done this. Probably even created a PDF that would crash any PDF reader out there. > If, your program then works correctly, then I am right. This will happen in only a few applications; I would argue it will never happen in anything that has to communicate with the outside world. > 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. Yes, it does, at least with PDF::Writer. The output for PDF has to be correct. And in this case, PDF::Writer would simply do the wrong thing. -austin -- Austin Ziegler * halostatue@gmail.com * Alternate: austin@halostatue.ca