On Tue, 9 Jul 2002 16:33:48 +0900, Yukihiro Matsumoto wrote:
> Hi,
> In message "Re: for ... else ... end"
> on 02/07/09, "Hal E. Fulton" <hal9000 / hypermetrics.com> writes:
>> And by the way, the Pythonism originally referenced is certainly
>> more elegant than the throw/catch example. I wonder if it's
>> useful enough to consider including?
>
>> Maybe it's one of those things you don't realize you need until
>> you have it.
> But I don't feel "for .. else" is intuitive. The "else" seem like
> indentation mistake rather than loop termination hook. Maybe there
> can be a more suitable keyword.

I can't say that I like the construct, although I can see its
utility. I'm also not sure that it fits into what I understand how
it would fit into Ruby's idiom better than the catch-throw
mechanism.

The problem I have with it is that 'for' is (more or less) syntactic
sugar for 'each', isn't it? It isn't necessary to do:

for ... do
  ...
end

Because it's the same as:

...each do
  ...
end

Right? (The same applies to {} blocks.) How would you work an 'else'
construct into a generic block, and what would it mean outside of an
'each' or 'for' construction?

I freely admit that my understanding could be wrong, but that's
where I think that this construct won't work in Ruby. (I also think
that the keyword should be something other than 'else', but I'm not
sure what it should be. It's something like a 'finally if normal
termination'...)

-austin
-- Austin Ziegler, austin / halostatue.ca on 2002.07.09 at 09.20.40