[racket] Engineering Tradeoffs of ANF transforms and the Stateless Server
Shiri,
While AJAX and client-side continuations enable significant client-side
computational complexity, I think they complement vs. eliminate the need
for server-side complexity.
I'm in pursuit of both (1) server complexity and (2) server-side
statelessness
I could achieve (1) by giving up (2), or (2) by forfeiting (1)
and the proximal reason I can't get both right now is I lack a very
limited dynamic-wind functionality compatible with #lang web-server.
Specifically:
a) I need a redefined dynamic-wind which uses a
a) call/cc-dynamic-wind to provide the correct prelude-postlude
behavior when a continuation reified with call/cc-dynamic-wind is
invoked.
c) Its perfectly fine *not* to have this behavior for continuations
which are reified normally, or exceptions, etc.
I think Friedman's [Friedman and Hayes: Constraining Control] page 17
implementation should do exactly this.
But, I can't understand why Friedman's code should work. Its over my
head. And its in scheme84.
There's a much much simpler implementation in the appendix to the 1992
paper [The Scheme of Things: The June 1992 Meeting], but it still
confuses me, especially the last five out of six lines of code.
Friedman uses a "rec" form, which seems to be the same as let* (which
would work with #lang web-server- One clear forbidden construct in #lang
web-server is a nested set! within a letrec within a define. That will
not compile.)
Friedman also uses "mapc", which my research has shown is a "for-each"
"thaw" might just be a function application, i.e. (mapc thaw state) ->
(for-each (lambda (fn) (fn)) state), where state is a list
I'm suspicious that set-car! and set-cdr! work the way one suspects,
otherwise
(set-cdr! state new-state)
(set! state new-state)
in Friedman doesn't make much sense to me. Also see last five of six
lines in the 1992 paper.
If anyone can provide any assistance in helping me to understand or
implement the Friedman code, I would be grateful.
Criticism of why this plan wouldn't work out is also appreciated.
Thanks
Zack