botp wrote:
> i prefer to refer to blocks as just mere codes that cannot stand on
> their own yet. They have to be proc-ified or lamba-fied or yielded as
> code blocks in methods.

You are right. Blocks are not even objects, just syntactical constructs 
which can potentially be associated with an object using Proc.new, 
#proc, #lambda, or the & notation. Yielding to a block doesn't cause any 
such object to be instantiated.

There is a small performance cost to this instantiation, so in general I 
try to write methods like this:

def foo; ... yield(something) ...; end

rather than

def foo(&bl); ... bl.call(something); end

Sometimes, though, you really need to instantiate a block and store it 
somewhere so it persists between method calls.

Another advantage of yield is that RDoc can automatically recognize it 
and document it.

-- 
        vjoel : Joel VanderWerf : path berkeley edu : 510 665 3407