7 May 12:31
[1.9] Continuation && Array#sort!
From: ts <decoux <at> moulon.inra.fr>
Subject: [1.9] Continuation && Array#sort!
Newsgroups: gmane.comp.lang.ruby.core
Date: 2008-05-07 10:35:19 GMT
Expires: This article expires on 2008-05-21
Subject: [1.9] Continuation && Array#sort!
Newsgroups: gmane.comp.lang.ruby.core
Date: 2008-05-07 10:35:19 GMT
Expires: This article expires on 2008-05-21
The example came from test/ruby/test_continuation.rb
vgs% cat b.rb
require 'continuation'
n = 1000
ary = (1..100).to_a
ary.sort! {|a,b|
callcc {|k| $k = k } if !defined? $k
if ary.size != 100
puts "#{n} #{ary.size}"
exit
end
a <=> b
}
n -= 1
$k.call if 0 < n
vgs%
vgs% ./ruby -v b.rb
ruby 1.9.0 (2008-05-07 revision 16311) [i686-linux]
998 15
vgs%
If you remove 'exit' it will segfault.
Look what it do with tmp in rb_ary_sort_bang()
Guy Decoux
(Continue reading)
RSS Feed