Re: Yield should be renamed call_block
- From: Florian Gross <florgro@xxxxxxxxx>
- Date: Tue, 10 Jul 2007 06:46:46 +0900
This is why if you ever want to pass a given block
to another method, you must capture it in a block argument, and also why
yielding to a block is much faster than calling a proc (since there's
less overhead in yielding than in calling a free-standing proc).
def thrice()
3.times { yield }
end
thrice { puts "Hello World!" }
# >> Hello World!
# >> Hello World!
# >> Hello World!
That doesn't have any impact on your original argument though. You
can't reimplement yield in Ruby with the reflection it offers right
now.
.
- References:
- Re: Yield should be renamed call_block
- From: Yukihiro Matsumoto
- Re: Yield should be renamed call_block
- From: John Joyce
- Re: Yield should be renamed call_block
- From: Charles Oliver Nutter
- Re: Yield should be renamed call_block
- Prev by Date: Re: Bug in Kernel#method objects that call super?
- Next by Date: Re: Get file size before download (noobish question)
- Previous by thread: Re: Yield should be renamed call_block
- Next by thread: Re: Yield should be renamed call_block
- Index(es):
Relevant Pages
|