On Nov 12, 5:00 am, Trans <transf... / gmail.com> wrote:
[...]
> In Ruby, methods are not first
> class objects. (Though to go with Ruby's 100% OOP mantra you would
> think they would be, but in any case...)
[...]

I used to think and wish for this too, and complain about it often.
Then, while implementing my own OOP version of Lua, I had an epiphany:

How can a method be a first-class object *and* have #super work?

For #super to work, you need a method to know what class it is
associated with, so that it can search the ancestor chain. But as soon
as you associate it with a class, it's no longer a first class object.

(If you try to use the class of the receiver, it works for one level
up, but beyond that it fails.)

For more details, see my original post on this topic. [1] Please poke
holes in it. I'd love to see how Ruby could treat all methods as first-
class objects interchangeable with blocks/procs/lambdas, unifying the
madness (which, of course, would need some way to control the
different arity handling), but I'm not seeing it as possible right
now.

[1] http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/179372
Feel free to poke holes in my argument