On Mon, Apr 22, 2002 at 11:53:16PM +0900, bbense+comp.lang.ruby.Apr.22.02 / telemark.stanford.edu wrote:
> - - Blocks are just a shortcut to handle the most common case in an 
>   efficent manner. It is a bit awkward that you have to use
>   different syntax ( foo.call vs. yield ). It seems to me
>   that this bit is one of the difficult things to master 
>   about Ruby. Blocks are syntax, not objects. If you need
>   an object use Proc. 

You can always get a Proc out of a block:

  def foo(&block)
    p block
    p block.call
  end

  def bar()
    p proc
    p proc.call
  end

  foo { 42 } #=> #<Proc:0x402978ac>
             #=> 42
  bar { 42 } #=> #<Proc:0x402978ac>
             #=> 42

Paul