From: Lionel Thiry Date: 2005-11-23T11:22:25+09:00 Subject: Re: a == nil or a.nil? ako... a �crit : > hello, > > this is more of a philosophical question. my C experience makes me feel > more comfortable with expressions such as 'a == nil' rather than > a.nil?. i feel strange when i invoke a method on a nil value. i know, > nil is also an object and not just a zero reference but still it feels > strange... > > would the experts please comment on why one way would be preferable > over the other? also, i am curious to know why nil? has been > implemented at all? is '== nil' not enough? > > thanks > konstantin > By the way, a == nil is also a method call. It is actually equivalent to: a.==(nil) If nil has a == method, why not adding some other practical methods like nil? ? Actually, nil? is probably a bit faster than ==(nil). -- Lionel Thiry Personal web site: http://users.skynet.be/lthiry/