On Thu, 26 Oct 2006 04:31:31 +0900, Gavin Kistner wrote:

> From: Morton Goldberg [mailto:m_goldberg / ameritech.net] 
>> I'd rather pass in a block. Is there a way to do that? Something like:
>> 
>> <pseud-code>
>> module Kernel
>>     def tell(obj, &to_do)
>>        # what goes here?
>>     end
>> end
>> 
>> tell Foo.new do
>>     report
>>     eat 'burger', 'fries'
>>     drink 'beer'
>>     be_merry
>> end
>> </pseud-code>
> 
> def tell( obj, &to_do )
>   obj.instance_eval( &to_do )
> end

Heck. Why bother with tell in the first place? Why not call instance_eval
directly?

--Ken

-- 
Ken Bloom. PhD candidate. Linguistic Cognition Laboratory.
Department of Computer Science. Illinois Institute of Technology.
http://www.iit.edu/~kbloom1/
I've added a signing subkey to my GPG key. Please update your keyring.