[plt-scheme] find-method/who
On Mar 22, 2005, at 1:20 PM, Matthew Flatt wrote:
>
>
>> By the way, is there a way to inspect the certificates of a syntax
>> object directly?
>
> Not currently.
I've spent some time debugging syntax certificates recently, and I've
got a small proposed change. The following code tries to do a bad
thing, by pulling 'a' out of its certified context.
(module hides-a mzscheme
(define a #t); secret!
(provide ref-to-a)
(define-syntax (ref-to-a stx)
(syntax-case stx ()
[(_) #`(if a 79 297)])))
(current-code-inspector (make-inspector (current-code-inspector))) ;
remove privileges from later code
(module tries-to-see-a mzscheme
(require hides-a)
(define a-stx (expand #`(ref-to-a)))
(printf "value of a: ~v\n"
(eval (syntax-case a-stx ()
[(i a-ref c d)
(syntax-recertify #`a-ref a-stx
(current-code-inspector) #f)]))))
(require tries-to-see-a)
=> compile: access from an uncertified context to unexported variable
from module: hides-a in: a
The location of the error is given as the 'eval'.
My proposal is this: rather than having the syntax-recertify fail
silently, producing an uncertified syntax-object, I would rather that
syntax-recertify raised an exception when the supplied inspector was
not powerful enough to transfer a certificate.
The problem is that when I see an error like the above, I can't tell
whether it's because I didn't call recertify in the right place, or
because my inspector wasn't strong enough.
I don't believe that the current behavior is documented, so it
shouldn't be the case that client code depends on this behavior.
Perhaps MzScheme depends on the current behavior?
john
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2430 bytes
Desc: not available
URL: <http://lists.racket-lang.org/users/archive/attachments/20050322/c5734564/attachment.p7s>