CPS 0.14

8.4/10 (27 أصوات )

الترجمة الالية للوصف



  • مرات التنزيل: 158
  • متطلبات التشغيل:
  • الحجم:
  • الترخيص:
  • الاصدار : 0.14
  • اضيف في: 0000-00-00 00:00:00
  • اخر تحديث: 29/05/2012
  • الموقع علي الانترنت:



استخدام البرامج التي تم تنزيلها من موقعنا يجب أن يكون وفقاً للقوانين في بلدك.لا نوصي باستخدام برامج تنتهك القوانين في بلدك.،اذا كنت تري ان هذا المحتوي لا يتوافق مع حقوق الملكية الفكرية برجاء ابلاغنا بالضغط هنا



Description




The functions in the CPS Perl module implement or assist the writing of programs, or parts of them, in Continuation Passing Style (CPS). Briefly, CPS is a style of writing code where the normal call/return mechanism is replaced by explicit "continuations", values passed in to functions which they should invoke, to implement return behaviour. For more detail on CPS, see the SEE ALSO section.What this module implements is not in fact true CPS, as Perl does not natively support the idea of a real continuation (such as is created by a co-routine). Furthermore, for CPS to be efficient in languages that natively support it, their runtimes typically implement a lot of optimisation of CPS code, which the Perl interpreter would be unable to perform. Instead, CODE references are passed around to stand in their place. While not particularly useful for most regular cases, this becomes very useful whenever some form of asynchronous or event-based programming is being used. Continuations passed in to the body function of a control structure can be stored in the event handlers of the asynchronous or event-driven framework, so that when they are invoked later, the code continues, eventually arriving at its final answer at some point in the future.In order for these examples to make sense, a fictional and simple asynchronisation framework has been invented. The exact details of operation should not be important, as it simply stands to illustrate the point. I hope its general intention should be obvious. :) read_stdin_line( \&on_line ); # wait on a line from STDIN, then pass it # to the handler functionSYNOPSIS use CPS qw( kwhile ); kwhile( sub { my ( $knext, $klast ) = @_; print "Enter a number, or q to quit: "; read_stdin_line( sub { my ( $first ) = @_; chomp $first; return $klast->() if $first eq "q"; print "Enter a second number: "; read_stdin_line( sub { my ( $second ) = @_; print "The sum is " . ( $first + $second ) . "\n"; $knext->(); } ); } ); }, sub { exit } );Product's homepage Requirements:

· Perl




Moshax.com only provide legal software, please help us keeping pur site legal, if you think this page is violating copyrights please let us know by clicking here Here





التعليقات علي CPS 0.14
اضافة تعليق

تعليقات الفيسبوك

تعليقات الموقع