On 12/12/06, Benedikt Heinen <ruby / ml.icemark.net> wrote: > On Tue, 12 Dec 2006, Wilson Bilkovich wrote: > >> From the Rubinius test suite: > > @count = 1 > > begin > > p @count > > raise ArgumentError, 'just kidding' unless @count > 3 > > rescue Exception => e > > @count += 1 > > retry > > else > > p 7 > > ensure > > p 8 > > end > > [...] > > > 'else' only runs if no exception was raised. > > Yes, else only runs if no exception was raised; and it will run BEFORE the > ensure block. BUT unlike code in the main code block (begin..rescue) it > CAN raise unchecked exceptions. > > > Do you feel like that's an implementation quirk of Ruby, or something deliberate? In other words, this code.. @count = 0 begin @count += 1 raise RuntimeError.new("Ha Ha!") if @count == 1 rescue Exception puts "hello from rescue" retry else puts "else" raise RuntimeError.new("Boom") if @count == 2 end Is it part of ruby's 'spec' that the 'rescue' block only be executed once, in the above code?