David Alan Black wrote:
> 
> Hello --
> 
> On Sun, 4 Nov 2001, Bob Sidebotham wrote:
David Alan Black wrote:
> The important thing to remember, though, is that you can associate a
> non-argument block with any method call.  So if you send a block as a
> regular argument, you can still also associate a block:
> 
>   def thing(a,b,c)
>     puts yield c.call(a, b)
>   end
> 
>   thing(1,2, proc { |x,y| x + y }) { |n| "result is #{n}" }
> 
>   # =>  result is 3

Why is this important? This still seems to be sugar for:

  def thing(a,b,c,d)
    puts d.call(c.call(a, b))
  end

  thing(1,2, proc { |x,y| x + y }, proc { |n| "result is #{n}" })

  # =>  result is 3

Does the first syntax somehow express the _intent_ of the code better?

Help me! I really have not seen the light yet.

Thanks,
Bob

P.S. I saw another post that made a reference to yield picking up blocks
up a level from the current frame. Is that a clue to some essential
behavior I'm missing, or a red herring, or what...?