Brian Candler wrote:
>>        "Duplicate names and techniques to do the same
>>        atomic thing ends up confusing the nubys"
> 
> ..
> 
>>#insert your own examples here
> 
> 
> I second your example of:
> 
>   def foo
>     ...
>     yield stuff if block_given?
>   end
> 
> versus:
> 
>   def foo(&blk)
>     ...
>     blk.call(stuff) unless blk.nil?
>   end
> 
> I think I would have found iterators much easier to get my head round if I
> had seen the second, rather than the first, initially.
> 
> And if you use the first syntax, there is the leap you have to make sooner
> or later: "hang on - how do I pass this block to another method?"; or
> conversely, "I have a proc object, but how do I pass it to a method which
> expects a block?"

Well, yes, I got hung up on this right off the bat--I got it into my 
head that yield was somehow dynamic, so that it would find some magic 
block up the stack to yield to . So I was very puzzled when I couldn't 
yield from within a method called by the method with the block.

I had assumed this level of dyanmicity since the block wasn't 
specified--it seemed obvious to me that objects would be simply invoked 
in a context where a yield would magically invoke some block defined 
somewhere.

If I'd had to declare the block from the start, then this would never 
have been an issue.

As a nuby, even when you *know* there's two ways to do something, you're 
stuck wondering if there is some subtle reason that one is better (or 
simply different) than the other. You see two mechanisms, can't find 
anything written that describes when to use one or the other, and are 
left puzzled and confused.

Bob