From: Robert Dober Date: 2006-09-26T22:06:50+09:00 Subject: Re: How to copy a method from one class to another ------=_Part_4973_23933938.1159276000833 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: quoted-printable Content-Disposition: inline On 9/26/06, Trans wrote: > > > 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 Method= s > > > >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} =3D=3D 42"; end > > > end > > > class B < A > > > define_method :another_a, A.instance_method(:a) > > > end > > > AA =3D 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 =3D=3D > Object.instance_method(:send).object_id > =3D> false Aha, I do not have the faintest idea what 1st class means - now because I follow suit to your knowledge - would you care to elaborate a little more? I guess that the unidentity you state above might come from some wrapper object dynamically allocated when getting the "object". Note to Logan: not being able to bind the method to an object outside of th= e inheritance tree stuck me at first too, but I think it is a good thing. OTOH it is somehow viaolating the idea of "MetaDuckTyping" (surely McCarthy did not say that) meta applies to DuckTyping it is not the type of a MetaDuck we are discussing ;) Cheers Robert T. > > > --=20 Deux choses sont infinies : l'univers et la b=EAtise humaine ; en ce qui concerne l'univers, je n'en ai pas acquis la certitude absolue. - Albert Einstein ------=_Part_4973_23933938.1159276000833--