Enumerator raises `dead fiber called'

e$B1sF#$H?=$7$^$9!#e(B

e$B0J2<$N%3!<%I$Ge(B dead fiber called
e$B$,H/@8$9$k$N$O;EMM$G$7$g$&$+!#e(B

def foo
raise StopIteration
end

g = to_enum(:foo)
g.next rescue p $! #=> StopIteration
g.next rescue p $! #=> dead fiber called

e$B$^$?!"0J2<$N$h$&$Ke(B Enumerator e$B$re(B dup
e$B$9$k$HJQ$J;v$K$J$j$^$9!#e(B

def foo
yield 1
end

g1 = to_enum(:foo)
p g1.next #=> 1
g2 = g1.dup
g1.next rescue p $! #=> iteration reached at end

p g2.next #=> #Fiber:0xb7d35cf4
g2.next rescue p $! #=> dead fiber called

Fiber e$B$,e(B dup e$B$G$-$J$$$N$G!"e(BEnumerator e$B$Ne(B dup
e$B$b6X;_$9$Y$-$G$Oe(B
e$B$J$$$G$7$g$&$+!#$=$&$G$J$$$H$7$F$b!"e(Benumerator_init_copy e$B$Ge(B
dst e$B$He(B no_next e$B$N%3%T!<$,O3$l$F$$$k$h$&$J5$$,$7$^$9!#e(B

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs