On 8/6/07, Phlip <phlip2005 / gmail.com> 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.
Do not do this, yield suffers a lot from a bad reputation it does not
deserve, see also David's benchmarks above.
>
> 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.
Why? I do not think that this is necessary.
Just replace the refactoring
old:  yield ==> something &blk
>
> --
>   Phlip
>   http://www.oreilly.com/catalog/9780596510657/
>   "Test Driven Ajax (on Rails)"
>   assert_xpath, assert_javascript, & assert_ajax
>
>
>


-- 
[...] as simple as possible, but no simpler.
-- Attributed to Albert Einstein