Ross Andrews <randr
@geekfu.org> writes:
> As I learn Scheme, I am sort of mentally figuring out what the minimum
> set of primitives is. Initially, I thought that dynamic-wind must be a
> primitive, but now I'm not so sure.
> If call/cc were never invented, you could make dynamic-wind by saying
> (define dynamic-wind
> (lambda (a b c)
> (begin a b c)))
> Since the only way into b is by calling it, this ensures that a and c
> are called before and after it. The problem, as so often, is that
> call/cc means we can jump into b from anywhere.
> So what if you masked call/cc somehow? If b calls call/cc then it
> really calls our fake call/cc, which returns a continuation that calls
> a first and c after.
That's the essence of it: CALL/CC needs to cooperate with DYNAMIC-WIND helpful in understanding the technicalities.