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
Rationals are:
* you can detect methods that don't take blocks, that
currently ignored silently.
* we can make yield sementics bit simpler.
The former is more prefereable.
matz.