From: Rick DeNatale Date: 2008-03-22T22:11:46+09:00 Subject: Re: ruby19 and defined? On 3/22/08, Sebastian Hungerecker wrote: > Roger Pack wrote: > > I know there was an RCR related to this once. Maybe it was accepted. > > > You mean an RCR proposing that defined? return true, right? > The problem here is not that defined? returns true instead of "method" though. > The problem is that it returns true instead of nil for the method that doesn't > exist. I doubt that that behaviour was proposed in an RCR. Hmmmm, not so sure that that's actually a bug. I've not found a good definition for what define? is supposed to do when given an expression instead of a simple term. It certainly never evaluated the expression. I don't know that I've ever used it with an expression, but my impression was that it works syntactically more than semantically, so whether or not a given expression would raise an exception when evaluated wouldn't affect whether the expression was defined. For example, I'd expect that defined?(1/0) would not indicate that the expression was undefined just because it represents a divide by zero. Having just looked at the latest beta of Pickaxe 3, I notice that Dave still has define? returning strings instead of true/nil, and the page has the red header indicating that it's been updated for 1.9. Personally, I'm unhappy if 1.9 is no longer returning a description of the syntactical class of the argument to defined? seems like a loss of valuable information, and I'd hope that it was the returning of nil rather than 'method' which is a bug. -- Rick DeNatale My blog on Ruby http://talklikeaduck.denhaven2.com/