Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Continuation
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
===Programming language support=== Many programming languages exhibit first-class continuations under various names; specifically: *[[Common Lisp]]: [http://common-lisp.net/project/cl-cont/ cl-cont]. One can also use custom macros *[[C Sharp (programming language)|C#]] / [[VB.NET]]: <code>async</code> and <code>await</code>: "sign up the rest of method as the continuation, and then return to your caller immediately; the task will invoke the continuation when it completes". [http://msdn.microsoft.com/en-us/vstudio/gg316360 Asynchronous Programming for C#] *[[Factor (programming language)|Factor]]: <code>callcc0</code> and <code>callcc1</code> *[[Haskell (programming language)|Haskell]]: The Continuation [[Monad (functional programming)|monad]] in <code>[http://hackage.haskell.org/packages/archive/mtl/2.0.1.0/doc/html/Control-Monad-Cont.html Control.Monad.Cont]</code> *[[Haxe]]: [https://github.com/Atry/haxe-continuation haxe-continuation] *[[Icon (programming language)|Icon]], [[Unicon (programming language)|Unicon]] : <code>create, suspend, @</code> operator: coexpressions *[[Java (programming language)|Java]]: [http://lightwolf.sourceforge.net/index.html Lightwolf] [http://commons.apache.org/sandbox/commons-javaflow/ javaflow] (requires bytecode manipulation at runtime or compile time) *[[Kotlin (programming language)|Kotlin]] : <code>Continuation</code> *[[Rhino (JavaScript engine)|JavaScript Rhino]] : <code>Continuation</code> *[[Parrot virtual machine|Parrot]]: <code>Continuation</code> PMC; uses [[continuation-passing style]] for all control flow *[[Perl]]: [https://metacpan.org/module/Coro Coro] and [https://metacpan.org/module/Continuity Continuity] *[[Pico (programming language)|Pico]]: <code>call(exp())</code> and <code>continue(aContinuation, anyValue)</code> *[[Python (programming language)|Python]]: [[PyPy]]'s <code>[https://web.archive.org/web/20231217182002/https://doc.pypy.org/en/latest/stackless.html#continulets _continuation.continulets]</code> *[[Racket (programming language)|Racket]]: <code>[[call-with-current-continuation]]</code> (commonly shortened to <code>call/cc</code>) *[[Ruby (programming language)|Ruby]]: <code>callcc</code> *[[Scala (programming language)|Scala]]: <code>scala.util.continuations</code> provides <code>shift</code>/<code>reset</code> *[[Scheme (programming language)|Scheme]]: <code>[[call-with-current-continuation]]</code> (commonly shortened to <code>call/cc</code>) *[[Smalltalk]]: <code>Continuation currentDo:</code>; in most modern Smalltalk environments continuations can be implemented without additional VM support. *[[Standard ML of New Jersey]]: <code>SMLofNJ.Cont.callcc</code> *[[Unlambda]]: <code>c</code>, the flow control operation for call with current continuation <!-- Please do not re-add the following entries: *Python: generators are not first-class continuations *Stackless Python: provides tasklets/coroutines only; first-class continuations were a target for the first implementation, but dropped --> In any language which supports [[closure (computer science)|closures]] and [[tail recursion|proper tail calls]], it is possible to write programs in [[continuation-passing style]] and manually implement call/cc. (In continuation-passing style, call/cc becomes a simple function that can be written with [[lambda calculus|lambda]].) This is a particularly common strategy in [[Haskell (programming language)|Haskell]], where it is easy to construct a "continuation-passing [[Monad (functional programming)|monad]]" (for example, the <code>Cont</code> monad and <code>ContT</code> monad transformer in the <code>mtl</code> library). The support for [[tail recursion|proper tail calls]] is needed because in continuation-passing style no function ever returns; ''all'' calls are tail calls.
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)