Hi --

On Thu, 12 May 2005, Robert Klemme wrote:

> David A. Black wrote:
>
>> I wonder whether some of the non-consensus about the changes you've
>> been discussing originates in the difference between loop constructs
>> per se, and iterators.  (loop itself appears to be a method, though
>> oddly it does not identify itself as an iterator.  But an infinite
>> loop can't really "return" anything anyway.)
>
>>> x = loop do; break "foo"; end
> => "foo"
>>> x
> => "foo"
>
> Sorry, couldn't resist. :-))

I thought about that one and decided I didn't count it as the loop
"returning" :-)

>> So the non-traditional loops you've listed are basically method calls
>> (including 'for', which I believe is just an 'each' wrapper).  I don't
>> know that this has to be a determinant one way or the other, but I
>> realize it's something that I'd semi-perceived but not quite put my
>> finger on that separates these things into two pretty distinct
>> categories.
>
> Eventually there's most likely a loop construct buried - even in those
> method calls...  The difference might be smaller than you think: both are
> expressions that return something, so the difference between while and
> each is not too big.

It's not big conceptually, but while is a keyword and each is a
method.  As I said, I don't think that has to determine how they act
with regard to returning values (class is also a keyword, and its
return behavior is very method-like) -- it's just another semantic
factor to keep in view.


David

-- 
David A. Black
dblack / wobblini.net