Jacob Fugal wrote:
> On 8/30/05, Trans <transfire / gmail.com> wrote:
> >
> > Jacob Fugal wrote:
> > >
> > >   class Object
> > >     def instance_send( symbol, *args, &block )
> > >       instance_eval { send( symbol, *args, &block ) }
> > >     end
> > >   end
> >
> > Nice, that would suffice (IMHO)
>
> Oh, and just looking at this again after your reply, I noticed the the
> instance_eval isn't even necessary since we're inside the instance in
> the body of instance_send anyways:
>
>   class Object
>     def instance_send( ... )
>       send( ... )
>     end
>   end

He he. That's kind of funny. Think I suggest this with
#within_instance, but I';; bet you anything that idea got a good sneer
by most people --but its nothing more then the above.

> That removes one level off the call stack. The stack in this
> circumstance would be one deeper than send with an explicit receiver,
> but not as deep as with an exterior instance_eval (since you have to
> enter instance_eval and then enter the provided block from there). I
> don't think the slight inefficiency compared to send with an explicit
> receiver is a problem. If it does turn into a problem, one can use
> #method and Method#call instead, right?

I suspect the current version of #send would just be renamed to
#instance_send (perhaps with some minor modifications), so it'll be
just as fast as it is now.

T.