[r6rs-discuss] [Formal] eliminate library export immutability loophole
> 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
Received on Mon Mar 12 2007 - 16:53:00 UTC
This archive was generated by hypermail 2.3.0
: Wed Oct 23 2024 - 09:15:01 UTC