On Nov 22, 8:52=A0pm, "ara.t.howard" <ara.t.how... / gmail.com> wrote:
> On Nov 22, 2008, at 4:22 PM, Roger Pack wrote:
>
> > would this be useful/theoretically possible?
> > UnboundMethod#to_proc
> > Thanks!
> > -=3DR
>
> cfp:~ > cat a.rb
> class UnboundMethod
> =A0 =A0def to_proc this =3D self
> =A0 =A0 =A0bind(self).to_proc
> =A0 =A0end
> end
>
> module M
> =A0 =A0def m
> =A0 =A0 =A042
> =A0 =A0end
> end
>
> include M
>
> p M.instance_method(:m)
>
> p M.instance_method(:m).to_proc(self).call
>
> cfp:~ > ruby a.rb
> #<UnboundMethod: M#m>
> 42
>
> the issues is, without binding, what is 'self' ??? =A0once bound, =A0
> to_proc exists.
>
> a @http://codeforpeople.com/
> --
> we can deny everything, except that we have the possibility of being =A0
> better. simply reflect on that.
> h.h. the 14th dalai lama

The main issue with this approach is that instances of UnboundMethod
can only be bound to objects of the same class on which the method was
originally defined. That's why I used Ruby2Ruby.