emacs-devel
[Top][All Lists]
Advanced

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

Re: Delimited continuations


From: John Wiegley
Subject: Re: Delimited continuations
Date: Sun, 10 Dec 2017 11:59:16 -0800
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.90 (darwin)

>>>>> "MH" == Michael Heerdegen <address@hidden> writes:

HM> (+ 1 2) is executed twice. I think this isn't necessarily so?

Yes, except if you think about it, this "initial evaluation" whose results
are thrown away can be used to establish lexical bindings to be captured
by the lambda passed to shift; or to influence which shift is used within
a complicated reset block.

HM> BTW, I wonder what one can potentially do with this stuff.

Although it's in Haskell, this is my favorite article on motivating the
expressive power of delimited continuations:

http://blog.moertel.com/posts/2005-09-13-scope-herding-with-delimited-continuations.html

Note that rather than simply using shift/reset lexically -- which *could* be
replaced by a lambda form parameterized over the insertion points -- it uses
shift/reset as the power behind a helper function.

Even his example, however, is a bit less meaningful in a context where side-
effects and dynamic binding are freely available.

-- 
John Wiegley                  GPG fingerprint = 4710 CF98 AF9B 327B B80F
http://newartisans.com                          60E1 46C4 BD1A 7AC1 4BA2



reply via email to

[Prev in Thread] Current Thread [Next in Thread]