On Thu, 2008-03-13 at 14:19 -0400, Swaroop Sridhar wrote: > >>> A capture of a by-ref formal variable (x) by an > >>> inner lambda (L) is safe only if: > >>> > >>> (1) L does not escape, or > >>> (2) The body of L does not use x as an lvalue that is a target of an > >>> assignment.
Consider:: (define i:(mutable int32) 1)) (define (g x: (by-ref (mutable int32))) (lambda () x)) ; Note that L escapes but the body of L does not use the captured by-ref formal parameter as an l-value. Now consider: (define captured (g i)) (pair (captured) (begin (set! i (+ i 1)) (captured)) Which must result in (1, 2). The capture here is actually okay because x is capturing a global, but that cannot be determined at the point where G is admitted. So I think that your conditions are not sufficient to ensure safety. shap _______________________________________________ bitc-dev mailing list bitc-dev@coyotos.org http://www.coyotos.org/mailman/listinfo/bitc-dev