dblack / wobblini.net wrote:

>> I think you are looking for Object#instance_eval.
>>
>> Note that in 1.8 there is no way to build-in way to execute a block in 
>> a different context and at the same time providing it with arguments.
>>
>> In 1.9 it will be possible to do that with Object#instance_exec.
> 
> Do you know why there are going to be two methods, instead of just
> adding argument capabilites to instance_eval?  I'm also not sure how
> 'eval' vs. 'exec' expresses arguments vs. no arguments.  Do you know
> the reasoning behind it?

Object#instance_eval used to pass self AFAIK. Making it pass arguments 
would either be an incompatible change or lead to a overly complex API.

I'm not sure about the exact reasoning about the names. I guess it is 
just because all eval methods don't pass arguments. And instance_exec 
kind of sounds related to instance_eval.

I can't think of a good name that expresses argument passing. 
instance_eval_with_args would work, but isn't good.

-- 
http://flgr.0x42.net/