From: Trans Date: 2006-09-26T21:55:14+09:00 Subject: Re: How to copy a method from one class to another Logan Capaldo wrote: > On Tue, Sep 26, 2006 at 05:24:48PM +0900, Robert Dober wrote: > > On 9/25/06, Gavin Kistner wrote: > > > > > > > > >Ruby's methods are not first-class functions like Lua or JavaScript > > >have. Other, first-class functions exist (procs/lambdas), but Methods > > >are not these. > > > > > > I tend to disagree, I do not know about Lua, but for me Ruby's methods are > > pretty much first class > Sometimes people define first class in terms of the additional syntax > compared to other things you must use. > > > > class A > > def a; puts "#{self} == 42"; end > > end > > class B < A > > define_method :another_a, A.instance_method(:a) > > end > > AA = Class.new A > > > > A.new.a > > A.instance_method(:a).bind(AA.new).call > > B.new.another_a > > They are Functor, but they are not 1st class Object.instance_method(:send).object_id == Object.instance_method(:send).object_id => false T.