[PRL] compiling `return'
Dave Herman
dherman at ccs.neu.edu
Thu Jun 23 00:33:42 EDT 2005
If you're compiling an imperative language with `return' into Scheme, is
the easiest implementation of tail call elimination to capture an escape
continuation (or raise an exception) that expects a thunk and then apply
the thunk in tail position? E.g.:
[[ proc(x1 .. xn) { ... return e; ... } ]]
= (lambda (x1 .. xn)
(let ([thunk (let/ec return
...
(return (lambda () [[ e ]]))
...)])
(thunk)))
Is this a trampoline?
Thanks,
Dave
More information about the PRL
mailing list