lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


>>>>> "William" == William Ahern <william@25thandclement.com> writes:

 > On Wed, Jul 19, 2023 at 06:24:59AM +0200, bil til wrote:
 >> Am Di., 18. Juli 2023 um 16:16 Uhr schrieb Marcus Mason <m4gicks@gmail.com>:
 >> > local B = coroutine.clone(A)  -- hypothetical
 >> >
 >> 
 >> ... and for which application do you think of this? Can you describe
 >> your application more in detail?

 William> The common term for this is call/cc or call-with-current-continuation:
 William> https://en.wikipedia.org/wiki/Call-with-current-continuation

I think it's a bit more like delimited continuations, since the
continuation is bounded to the coroutine in question and doesn't extend
to the whole rest of the program.

I _think_ you could implement shift/reset with coroutine.clone(), which
would be very interesting.

 William> IIRC, formally the call/cc primitive can be used to implement
 William> most (all?) forms of control flow, including common controls
 William> like return or less common like backtracking,

Some would argue that delimited continuations are more general. I've
certainly found them (when using Scheme) to be more useful than call/cc.

-- 
Andrew.