Yukihiro Matsumoto wrote:
> I'm not sure what you mean by the word "right" here.  It's ok for you
> to write that kind of program, but I don't (can't) guarantee you will
> get what you expect, although I try my best.  It might cost you much
> to guarantee loop safety.  It shouldn't crash in any case though.

Though I was confused for half of the day today, I have to admit that 
the current implementation is probably for the best. Where this:

arr.each do |x|
    if y; arr.delete(x); end
end

Can be made to work the way I personally thought it would, it's much 
safer to do something like this:

delete_list = []
arr.each do |x|
    if y; delete_list.push(x); end
end
arr -= delete_list

Or better yet, since Ruby includes the feature, use Array#delete_if.

> Yes, Ruby obeys you if you command it to loop infinitely.

I was more asking if that's what would happen, but I suppose the wording 
of my question made its own answer :-)

-- 
Posted via http://www.ruby-forum.com/.