£Á°èZ¨Ä…–K§‚«“ô4“ÒÙ´dîfUÙÃÅ WKbyʦ•ꎅȮFÒ¿ÊÎóCozá¬S@6{Í:›œêZÌ:Š•_%:¢¾¾~;‘Ã~芩ÊÇí`ÔÑ©ú뙵'5I¿fš×WO%ø9¾«¾DK|€ùÍD”Ýs]nHÕ¶ê×Ӽ㞪éUWŸÈË%DÒÕ¬ï‘]/Åcx ‰ï2ß]ä6G[]S£Ôϯrs{úëóµmÒï#UQxo·õÞCe]"±/aÙ&Eã4ú9Jé_ÞåëdãöKë)AÞ ¯¹ægƒÛowÐø^d™ý½ßB7áyMä9ÜÖUã
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
--- !ruby/object:RI::ClassDescription
attributes: []
class_methods: []
comment:
- !ruby/struct:SM::Flow::P
body: Continuation objects are generated by Kernel#callcc. They hold a return address and execution context, allowing a nonlocal return to the end of the callcc block from anywhere within a program. Continuations are somewhat analogous to a structured version of C's setjmp/longjmp (although they contain more state, so you might consider them closer to threads).
- !ruby/struct:SM::Flow::P
body: "For instance:"
- !ruby/struct:SM::Flow::VERB
body: " arr = [ "Freddie", "Herbie", "Ron", "Max", "Ringo" ]\n callcc{|$cc|}\n puts(message = arr.shift)\n $cc.call unless message =~ /Max/\n"
- !ruby/struct:SM::Flow::P
body: produces:
- !ruby/struct:SM::Flow::VERB
body: " Freddie\n Herbie\n Ron\n Max\n"
- !ruby/struct:SM::Flow::P
body: "This (somewhat contrived) example allows the inner loop to abandon processing early:"
- !ruby/struct:SM::Flow::VERB
body: " callcc {|cont|\n for i in 0..4\n print "\\n#{i}: "\n for j in i*5...(i+1)*5\n cont.call() if j == 17\n printf "%3d", j\n end\n end\n }\n print "\\n"\n"
- !ruby/struct:SM::Flow::P
body: produces:
- !ruby/struct:SM::Flow::VERB
body: " 0: 0 1 2 3 4\n 1: 5 6 7 8 9\n 2: 10 11 12 13 14\n 3: 15 16\n"
constants: []
full_name: Continuation
includes: []
instance_methods:
- !ruby/object:RI::MethodSummary
name: "[]"
- !ruby/object:RI::MethodSummary
name: call
name: Continuation
superclass: Object