Do any non-Lisp/Scheme languages have continuations?
Writing a Lisp: Continuations
11–20 of 51 posts
Re: Writing a Lisp: Continuations
#12Then a real programming language can replace all "business processing" crap languages. Let's say you write a framework that escapes to a continuation whenever the "process" is waiting for Futures or Promises to complete, and returns the thread to a pool.
Depending on what you are waiting for, such as webhooks, asynch events/messages, or with some work even outstanding network requests ( if it's meaningful ), it would be possible to serialize the continuation to storage, potentially restore it on another machine, weeks later.
With some bookkeeping, it would be possible to also store what Futures have been completed, and what the continuation is currently waiting for, so it would be possible to keep track of the progress of the long running process, and use that information to show a nice status report.
Re: Writing a Lisp: Continuations
#13Re: Writing a Lisp: Continuations
#14Continuations are strangely underused, as they enables writing long-living processes in a simple way, without having to keep them in running in a thread, or even in memory. Then a real programming language can replace all "business processing" crap languages. Let's say you write a framework that escapes to a continuation whenever the "process" is waiting for Futures or Promises to complete, and returns the thread to…
Re: Writing a Lisp: Continuations
#15Do any non-Lisp/Scheme languages have continuations?
Javscript has promises and async/await
Re: Writing a Lisp: Continuations
#16Re: Writing a Lisp: Continuations
#17I remember trying to learn continuations during my CS degree, and evidently even today I still don't understand them. The examples don't seem to help either – how exactly does the control flow function?
A weird thing is that call-with-current-continuation doesn't yield back to something; it yields to the function given to call-with-current-continuation.
Re: Writing a Lisp: Continuations
#18Do any non-Lisp/Scheme languages have continuations?
Here's the obligatory "Haskell has a monad for that" comment http://hackage.haskell.org/package/mtl-2.2.1/docs/Control-Mo...
One thing I like about Haskell is that it's designed so that adding new control flow is not a big deal -- just design a monad. In Scheme it seems to be more work to get it all right.
Re: Writing a Lisp: Continuations
#19Continuations are strangely underused, as they enables writing long-living processes in a simple way, without having to keep them in running in a thread, or even in memory. Then a real programming language can replace all "business processing" crap languages. Let's say you write a framework that escapes to a continuation whenever the "process" is waiting for Futures or Promises to complete, and returns the thread to…
Re: Writing a Lisp: Continuations
#20Do any non-Lisp/Scheme languages have continuations?