On Jul 9, 2007, at 9:27 AM, John Joyce wrote:
> On Jul 9, 2007, at 7:06 AM, Yukihiro Matsumoto wrote:
>> Hi,
>>
>> In message "Re: Yield should be renamed call_block"
>>     on Mon, 9 Jul 2007 19:17:13 +0900, dblack / wobblini.net writes:
>>
>> |> I am not going to rename it.  But in far future (3.0? maybe), the
>> |> keyword will be removed from the language, and you will access  
>> blocks
>> |> via block arguments of methods.
>> |
>> |I'm curious what the rationale is for that.  Also, will the block
>> |syntax be removed, in favor of Proc arguments?
>>
>> The code
>>
>>   def ntimes(n)
>>     n.times do
>>       yield
>>     end
>>   end
>>
>> would go like this
>>
>>   def ntimes(n, &b)
>>     n.times do
>>       b.yield
>>     end
>>   end
>>
>>
> the '&' sigil is kind of scary. Reminds me of C. I'd be  
> disappointed to see Ruby get more sigils.

That's already part of the language.  You can use it right now to  
capture the block associated to a method as a Proc that you can  
manipulate.  Using &block you'd test block.nil? in the same way that  
you'd use block_given? when deciding to yield.  If you change the  
above code to be b.call, it works right now.

-Rob

Rob Biedenharn		http://agileconsultingllc.com
Rob / AgileConsultingLLC.com