--V3eawNQxI9TAjvgi Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Eric Hodel (drbrain / segment7.net) wrote: > Ben Giddings (ben / thingmagic.com) wrote: > > > Is there some reason that Continuation.new couldn't work? > > I don't know if this is 100% correct: > > class Continuation > def self.new > if block_given? then > callcc { |c| yield(c) } > else > callcc { |c| return c } > end > end > end Oh yes, and there is this problem: irb(main):007:0> c = Continuation.new; puts 'hi' hi => nil irb(main):008:0> c.call hi => nil irb(main):009:0> c.call NoMethodError: undefined method `call' for nil from (irb):9 Which is easily avoided with the block: irb(main):012:0> cx = nil => nil irb(main):013:0> callcc { |c| cx = c }; puts 'hi' hi => nil irb(main):014:0> cx.call hi => nil irb(main):015:0> cx.call hi => nil irb(main):016:0> cx.call hi => nil The block makes this easy. -- Eric Hodel - drbrain / segment7.net - http://segment7.net All messages signed with fingerprint: FEC2 57F1 D465 EB15 5D6E 7C11 332A 551C 796C 9F04 --V3eawNQxI9TAjvgi Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.2 (FreeBSD) iD8DBQE/MZTsMypVHHlsnwQRAvimAKDposWIsPsibsrCZuigLmKHedLB5QCdFJ0T hkuwKgMvGjc8Bn5ig2m+oR8Lu -----END PGP SIGNATURE----- --V3eawNQxI9TAjvgi--