s/s/d tail call optimization
svn: r1389
This commit is contained in:
parent
06c60a7f18
commit
c478a29110
|
@ -122,11 +122,18 @@
|
|||
;; send/back a response generated from a procedure that may convert
|
||||
;; procedures to continuation urls
|
||||
(define (send/suspend/dispatch response-generator)
|
||||
; This restores the tail position.
|
||||
; Note: Herman's syntactic strategy would fail without the new-request capture.
|
||||
; (Moving this to the tail-position is not possible anyway, by the way.)
|
||||
(let ([thunk
|
||||
(let/ec k0
|
||||
(send/back
|
||||
(response-generator
|
||||
(opt-lambda (proc [expiration-handler (current-servlet-continuation-expiration-handler)])
|
||||
(let/ec k1 (k0 (proc (send/suspend k1 expiration-handler)))))))))
|
||||
(let/ec k1
|
||||
(let ([new-request (send/suspend k1 expiration-handler)])
|
||||
(k0 (lambda () (proc new-request)))))))))])
|
||||
(thunk)))
|
||||
|
||||
;; send/suspend/callback : xexpr/callback? -> void
|
||||
;; send/back a response with callbacks in it; send/suspend those callbacks.
|
||||
|
|
Loading…
Reference in New Issue
Block a user