Exceptions that Fiber#yield raises


#1

e$B$3$s$P$s$O!"e(Bsheepman e$B$G$9!#e(B

Fiber#yield e$B$,Ej$2$kNc30$,!"%P%C%/%H%l!<%9$K>pJs$r4^$s$G$J$$$N$Ge(B
e$B%G%P%C%0$NLr$KN)$A$^$;$s!#$I$3$G%(%i!<$,5/$-$?$+J,$+$k$h$&$K$G$-$J$$e(B
e$B$G$7$g$&$+!#Nc$($P0J2<$_$?$$$J46$8$G!#e(B

$ cat r.rb
class Fiber
def self.new2(&b)
self.new {
begin
b.yield
rescue => e
e
end
}
end

def yield2
ret = self.yield
if ret.is_a? Exception
raise ret
else
ret
end
end
end

def raize
raise StandardError
end

f = Fiber.new2 do
raize
end

f.yield2

$ ruby-1.9 -v r.rb
ruby 1.9.0 (2007-06-10 patchlevel 0) [i686-linux]
r.rb:23:in raise': StandardError (StandardError) from r.rb:23:inraize’
from r.rb:27:in block in <main>' from r.rb:5:inyield’
from r.rb:5:in `block in new2’


#2

e$B!!$5$5$@$G$9!#e(B

sheepman e$B$5$s$O=q$-$^$7$?e(B:

Fiber#yield e$B$,Ej$2$kNc30$,!"%P%C%/%H%l!<%9$K>pJs$r4^$s$G$J$$$N$Ge(B
e$B%G%P%C%0$NLr$KN)$A$^$;$s!#$I$3$G%(%i!<$,5/$-$?$+J,$+$k$h$&$K$G$-$J$$e(B
e$B$G$7$g$&$+!#Nc$($P0J2<$_$?$$$J46$8$G!#e(B

e$B!!LdBj$,$h$/$o$+$i$J$+$C$?$N$G$9$,!":#$Ne(B Fiber
e$B$NNc30EAGE$OJQe(B
e$B$J$N$G!"$=$s$J$U$&$KJQ$($F$_$^$9!#e(B