Mon Sep 14 11:27:48 CEST 2009
Delimited Continuations and Staging
Avoiding monads using delimited continuations.
In the latter, ``scope extrusion'' (the possibility of bringing
variables outside of their scope using assignments) is illustrated
using the following MetaOCaml example:
let r = ref .<1>. in
.<fun y -> .~(r := .<y>.; .<()>.)>.; !r
Inside the escape .~( ) a code value is assigned to the reference r
and referenced outside of the quotation .< >. to be returned as the
value of the whole expression. This code value is ill-formed: the
variable y_1 (y renamed) is no longer bound.
Arbitrary shift/reset will give similar problems: variables can be
transported outside of their scope. The paper suggests an approach
where shift/reset is still used, but escapes are limited up to the
So the thing to figure out is how this translates to scheme: is it
worth limiting control effects (since we have no typing, but do want
to have correct scoping).