From: Jacob Fugal Date: 2005-12-15T01:40:03+09:00 Subject: Re: Undefined method On 12/14/05, Tom Reilly wrote: > You could also define [] for the nil class and have it return whatever > you thought appropriate. For example: > > class NilClass > def [] > nil #or whatever you want returned > end > end No, no, NO! See, this situation is exactly why I *wouldn't* want Ruby's nil to follow the NilObject pattern (or whatever it's called). If it did, Mark would be getting wrong results as opposed to the undefined method exception. Which do you think is easier to debug? I'll take the exception that tells me what line number, any day. Jacob Fugal