On Sat, Jun 28, 2008, Ruby Freak wrote:
> well, I guess it works, but
> I find it undependable in the fact that it is not actually doing what
> I expect. I expect that it will tell me if a variable has been, well,
> defined as a variable. In the case of the unused variable "y", I
> expect that it would tell me that the variable "y" has not been used.
> What I get back is the fact that "y" is a method. That has some useful
> aspects, but it is not what I am after or what I expected.
> 
> Possibly I simply have inaccurate expectations. For whatever reason, I
> expect a method/keyword that ends in "?" to return a boolean. (which
> is probably just my imagination)

I think this is the case.  For one thing, variables are effectively just
pointers.  y is defined, and it points at a method.  The predicate is
returning something that can be treated as a boolean which is sort of
the duck-typing way.

I kind of like the way that defined? behaves, because it gives you more
information than a simple boolean would.  That said, I understand your
frustration as well, because it is surprising that it would tell you
about methods.

Ben