From: ts Date: 2001-09-30T16:26:06+09:00 Subject: [ruby-talk:21837] Re: Segfault with callcc >>>>> "P" == Paul Brannan writes: P> class Foo P> def initialize(arr) P> cc1 = nil P> arr.each do |f| P> cc1 = callcc do |cc2| P> callcc do |cc1| P> cc2.call(cc1) P> end P> return P> end P> end P> # If I put a puts "foo" here, then this code doesn't crash. P> cc1.call(nil) unless not cc1 P> end P> end It's funny to use :-) pigeon% cat b.rb #!/usr/bin/ruby def tt cc1 = nil [1].each do |f| cc1 = callcc do |cc2| callcc do |cc1| cc2.call(cc1) end return end end puts cc1 cc1.call(nil) unless not cc1 end tt a = "a new name for Continuation" tt pigeon% pigeon% b.rb # # pigeon% Only one problem, it's difficult to predict which variable is recycled :-) Guy Decoux