From: Florian Gross Date: 2004-10-18T14:09:24+09:00 Subject: Re: callcc Semantics --------------060108080901050500010402 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Bill Atkins wrote: > What is the purpose of the block passed to callc? Is there a reason > that callcc doesn't just return the Continuation object? Mostly tradition, I think. Plus without the block and no new arguments there would be no way of knowing whether the Continuation was called yet or not. I've done my own variation (I always felt the interface of callcc was inside out -- yielding instead of returning) which lets you supply arguments on creation and overwrite them on invokation; it then returns the Continuation and those arguments. I've attached the file with my interface as I think callcc itself won't change much -- maybe this is a help to you anyway. Regards, Florian Gross --------------060108080901050500010402 Content-Type: text/plain; name="simplecc.rb" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="simplecc.rb" def Continuation.create(*args, &block) args = [args] if not args.nil? and not args.is_a? Array # 1.6.8 compatibility cc = nil; result = callcc {|c| cc = c; block.call(cc) if block and args.empty?} result ||= args return *[cc, *result] end --------------060108080901050500010402--