From: gwtmp01@... Date: 2006-07-03T09:56:21+09:00 Subject: Re: Is a block converted to a Proc object before yield? --Apple-Mail-1--365200550 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed On Jul 1, 2006, at 8:05 PM, Joel VanderWerf wrote: > 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. I like to compare these situations as 'explicit block argument' vs. 'implicit block argument'. You could also think of it as named vs. anonymous. In any case, as long as the block remains unnamed/ implicit there is no need to package it up into an explicit object (i.e. instance of Proc). It is the objectification step that burns up the extra cycles. Gary Wright --Apple-Mail-1--365200550--