From: Joel VanderWerf Date: 2006-07-02T09:05:13+09:00 Subject: Re: Is a block converted to a Proc object before yield? Alexandru Popescu wrote: > Thanks Joel... it looks like my initial understanding was wrong. It is > not block.call the one that triggers block to Proc conversion, but in > fact passing blocks as parameters. Is this the correct understanding? Right, it happens when the block is passed to a method that expects a "&block" argument (or if the method explicitly calls Proc.new). If you are executing "block.call", then "block" is a variable and it, like any variable, refers to an object. It's up to the callee, not the caller, to determine how to treat the block: either yield to it or turn it into an object. The former has a small performance advantage (and yield is an elegant notation). The latter allows the Proc object to be saved away somewhere and called even after the method has finished. -- vjoel : Joel VanderWerf : path berkeley edu : 510 665 3407