Server IP : 66.29.132.122 / Your IP : 3.145.37.250 Web Server : LiteSpeed System : Linux business142.web-hosting.com 4.18.0-553.lve.el8.x86_64 #1 SMP Mon May 27 15:27:34 UTC 2024 x86_64 User : admazpex ( 531) PHP Version : 7.2.34 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /proc/self/root/proc/self/root/proc/thread-self/root/proc/thread-self/root/proc/self/root/proc/thread-self/root/proc/self/root/proc/self/root/opt/alt/ruby18/share/ri/1.8/system/Continuation/ |
Upload File : |
--- !ruby/object:RI::ClassDescription attributes: [] class_methods: [] comment: - !ruby/struct:SM::Flow::P body: Continuation objects are generated by <tt>Kernel#callcc</tt>. They hold a return address and execution context, allowing a nonlocal return to the end of the <tt>callcc</tt> block from anywhere within a program. Continuations are somewhat analogous to a structured version of C's <tt>setjmp/longjmp</tt> (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: <em>produces:</em> - !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: <em>produces:</em> - !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