[r6rs-discuss] [Formal] eliminate library export immutability
loophole
R. Kent Dybvig
dyb at cs.indiana.edu
Mon Mar 12 16:53:00 EDT 2007
> Here is a modification to library L1 that gets around
> the above "loophole fix":
>
> (library (L1)
> (export y get-y set-y!)
> (import (r6rs))
> (define x #f)
> (define y (car x))
> (define z ((caddr x)))
> (define get-y (lambda () y))
> (define set-y! #f)
> (set! x (call/cc (lambda (k) (list 0 k values))))
> (set! set-y!
> (lambda (v)
> (call/cc (lambda (k) ((cadr x) (list v (cadr x) k)))))))
This explicitly sets an export (set-y!), which is considered a syntax
violation. Even if it didn't, the call to car in the fifth line of your
code would raise an exception at run time.
I don't believe there is a way around the loophole fix, i.e., any way to
alter either an exported variable or its local counterpart.
Kent
More information about the r6rs-discuss
mailing list