From: Dave Thomas Date: 2007-11-24T07:19:32+09:00 Subject: Re: retry semantics changed On Nov 23, 2007, at 3:53 PM, Yukihiro Matsumoto wrote: > |Removing it because of the potential side effects seems somewhat > |brutal. But, if we are going to remove this case, then I'd vote to > |remove its use in blocks altogether, and leave it just for > exceptions. > > That's what Evan Phoenix said. But can you elaborate? I'm thinking that allowing retry in a block still has the effect of invoking the controlling method again, reevaluating its arguments. This means that the issues of side effects are still present: class Dave def each(*args) puts "In each" yield 1 end end def method_with_side_effects puts "calling method_with_side_effects" exit if @already_executed @already_executed = true end Dave.new.each(method_with_side_effects) do |i| retry end Which outputs calling method_with_side_effects In each calling method_with_side_effects So, by removing the ability to call it from the controlling method, we remove the ability to implement control structure-style constructs (such as do_while), but we still leave the door open to side effects. So it seems that we've lost some capability and not really gained very much in exchange. But I'm sure that there are subtleties I'm missing. Dave