Name : perl-CPS
| |
Version : 0.19
| Vendor : obs://build_opensuse_org/devel:languages:perl
|
Release : 3.47
| Date : 2024-08-05 20:09:28
|
Group : Development/Libraries/Perl
| Source RPM : perl-CPS-0.19-3.47.src.rpm
|
Size : 0.08 MB
| |
Packager : (none)
| |
Summary : manage flow of control in Continuation-Passing Style
|
Description :
*Note*: This module is entirely deprecated now. It is maintained for compatibility for any code still using it, but please consider rewriting to use Future instead, which offers a far neater method of representing asynchronous program and data flow. In addition, Future::AsyncAwait can further improve readability of \'Future\'-based code by letting it use the familiar kinds of Perl control structure while still being asynchronous.
At some later date this entire \'CPS\' module distribution may be deleted.
The functions in this 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
This module itself provides functions that manage the flow of control through a continuation passing program. They do not directly facilitate the flow of data through a program. That can be managed by lexical variables captured by the closures passed around. See the EXAMPLES section.
For CPS versions of data-flow functionals, such as \'map\' and \'grep\', see also CPS::Functional.
|
RPM found in directory: /packages/linux-pbone/ftp5.gwdg.de/pub/opensuse/repositories/devel:/languages:/perl:/CPAN-C/openSUSE_Tumbleweed/noarch |