From: Alexandru Popescu Date: 2006-07-02T07:39:40+09:00 Subject: Re: Is a block converted to a Proc object before yield? 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? ./alex -- .w( the_mindstorm )p. --- (http://themindstorms.blogspot.com) On 7/2/06, Joel VanderWerf wrote: > Alexandru Popescu wrote: > > While to anybody else this code made things clear, for me it is still > > a little bit confusing: > > > > why outer12 is performing slower than outer22? > > > > According to prev posts, I have understood that the usage of > > block.call requires a conversion to a Proc and this is slower. But in > > above case where is this conversion taking place? (or simply, why is > > it slower?). > > >> def outer12(&bl) > >> inner2(&bl) > >> end > > The conversion from block to a Proc object happens because of the &bl in > the above definition. When outer12 is actually called, the Proc is > instantiated and the variable bl is bound to it. > > >> def outer22 > >> inner2 {yield} > >> end > > No & here, so no Proc is created. > > -- > vjoel : Joel VanderWerf : path berkeley edu : 510 665 3407 > >