On Aug 6, 5:02 am, dbl... / rubypal.com wrote: > Hi -- > > On Mon, 6 Aug 2007, Phlip wrote: > > Ronald Fischer wrote: > > >> Is there a principal reason when to prefer call over yield (or vice versa), > >> or are these only syntactic variations of the same feature? > > > I am learning to consider 'yield' as a fossil of an early Ruby that could not > > treat the bound block as a variable. I only use 'yield' as a slight > > convenience - a few less characters to type - in application-specific code. > > > When writing API-style code, I always start with &block because it's only a > > matter of time before I refactor the code and start passing that &block into > > a helper method. > > I think that's premature pessimization :-) See my other post for some > benchmarks on yield vs. capture-and-call. Is there no way for Ruby to optimize in the &block case? After all, they are functionally equivalent if you only use #call on the block. T.