On Friday 06 May 2005 12:07 am, Austin Ziegler wrote:
> Right. But why should I have to make that change for just about any
> application that I end up writing? There are a lot of cases where
> nil can arise -- and if it does arise, it may be incorrect. Do you
> *want* to give me RSI by forcing me to do:
>
> ? ? foo.bar unless foo.nil?
>
> Sorry, but the current behaviour is more correct.

Actually, it is the current behavior that forces you to write the "unless 
foo.nil?", since sending the "bar" message to nil is an error. If nil was 
changed to be a message eating variant, then 

    foo.bar
and
    foo.bar unless foo.nil?

would be equivalent. In other words, the change would help alleviate your RSI 
problems.

I will admit that my gut reaction is to fall in the "should throw an 
exception" camp.  But the idea of a universal Null Design Pattern with nil is 
intriguing.  John's suggested experiment is fairly painless ... I'm willing 
to try it and see if I'm persuaded.

-- 
-- Jim Weirich    jim / weirichhouse.org     http://onestepback.org
-----------------------------------------------------------------
"Beware of bugs in the above code; I have only proved it correct, 
not tried it." -- Donald Knuth (in a memo to Peter van Emde Boas)