On Sep 27, 2006, at 4:47 PM, Robert Dober wrote:
> I would define Ruby Methods as first class objects as they meet  
> *all* the
> conditions above

If you are talking about instances of the Method class, then yeah, they
are first class objects, but they are really just wrappers that delegate
to the underlying 'method', which I don't think is ever *directly*  
accessible.


So the code/data structure that gets created under the hood via  
something like:

	def a_method; end

and which we call a 'method' isn't really the same thing as an  
instance of Method,
which we also call a method. :-)

So I would say that instances of Method are first class objects but  
that methods
themselves are not first class objects.

This is similar to the way that instances of Proc are wrappers around  
Ruby
blocks, which are also never *directly* accessible. Proc instances  
are first
class objects, but blocks aren't.

Another example might be the array of bytes that is associated with  
an instance
of String.  Strings are first class objects but the data associated  
with a string
is not.

At least that is the way I think about these things.  I'm sure if I  
was up to
speed on ruby internals it would be quite easy to point out the  
differences between
method definitions and instances of Method and blocks and instances  
of Procs.


Gary Wright