On Mar 11, 2020, at 7:39 AM, Jörg F. Wittenberger Joerg.Wittenberger@softeyes.net wrote:
On Tue, 10 Mar 2020 21:19:01 -0400 Marc Feeley feeley@iro.umontreal.ca wrote:
On Mar 10, 2020, at 6:41 PM, Jörg F. Wittenberger Joerg.Wittenberger@softeyes.net wrote:
;; YMMV, but I find this not exactly intuitive.
On the contrary I find it very intuitive!> I give an example of why this semantics is what you want in the paper “A Better API for First-Class Continuations” section 1.3 (https://www.researchgate.net/publication/2405339_A_Better_API_for_First-Clas...).
Note. I'm not saying that it would be wrong by any means.
Just warn that there is an assumption I'd say is "intuitive" (at least for the novice): that "parameterize" is somewhat similar to "let", i.e., "values are bound within". They are just different scope and secretly unwound behind the szene.
In practice I'm much easier confused understanding code with dynamic scope applies than code where lexical scope rules.
Jörg
As Hendrik points out, the complexity is brought about (or exposed) by continuations.
The same can be said of letrec which can behave unintuitively when continuations are used. It means that these two expressions are not equivalent:
(let ((v (f x))) …) (letrec ((v (f x))) …)
because the use of continuations can reveal the “set!” that is part of the semantics of letrec.
Marc