From: Sylvain Joyeux Date: 2008-06-14T23:17:37+09:00 Subject: Re: raise and rescue --Dxnq1zWXvFF0Q93v Content-Type: text/plain; charset=us-ascii Content-Disposition: inline There is no direct way, but you can implement it using continuations (would not be supported in 1.9 though ...) See attached file Sylvain --Dxnq1zWXvFF0Q93v Content-Type: application/x-ruby Content-Disposition: inline; filename="restartable.rb" Content-Transfer-Encoding: quoted-printable module RestartableException=0A attr_accessor :raising_context=0A def = restart=0A raising_context.call=0A end=0Aend=0A=0Amodule Kernel= =0A def restartable=0A yield=0A rescue Exception =3D> e=0A = e.extend RestartableException=0A Kernel.callcc do |cc|=0A = e.raising_context =3D cc=0A raise e=0A end=0A = retry=0A end=0Aend=0A=0Adef raise_deep_down(lvl)=0A if lvl =3D=3D 0= =0A puts "line #{lvl}:1"=0A puts "line #{lvl}:2"=0A pu= ts "line #{lvl}:3"=0A restartable do=0A if @do_pass=0A = puts "retrying ..."=0A else=0A @do_p= ass =3D true=0A raise=0A end=0A end=0A = puts "line #{lvl}:4"=0A puts "line #{lvl}:5"=0A else=0A = raise_deep_down(lvl - 1)=0A end=0Aend=0A=0Abegin=0A raise_deep_down= (10)=0Arescue RestartableException =3D> e=0A e.restart=0Aend=0A=0A --Dxnq1zWXvFF0Q93v--