[plt-scheme] How to recognize untouchable syntax

From: Kimberley Burchett (kim.burchett at gmail.com)
Date: Mon Jul 24 21:31:05 EDT 2006

If you fully expand an arbitrary bit of syntax, there's a chance
you'll end up with a reference to an identifier that wasn't exported
from the module in which it was defined.  Mzscheme's certificate
mechanism was designed to ensure that you can't extract this reference
and attempt to use it in unauthorized ways.  Specifically, the
identifier is embedded in an enclosing expression that has a
certificate granting access to the identifier.  In effect, the
enclosing expression is "off limits" to anyone who would like to
reshuffle the expanded code.

My question is: what is the approved technique for a humble macro
author to recognize whether a given bit of syntax is off limits or
not?  I've read and reread chapter 12 of the mzscheme manual, but it
doesn't seem to be possible to enumerate the certificates attached to
a bit of syntax.  There's also no obvious way to find out whether one
inspector is superior to another inspector.

One thing that looks like the beginning of a solution is that
unexported identifiers end up with a "protected" syntax property.
Unfortunately, while this alerts me to the potential for problems, it
doesn't tell me the extent of the untouchable syntax region.

If there were some way to just check whether a given bit of rearranged
syntax satisfies the certificate requirements, then I could use that
and be happy.  Have I overlooked the
check-that-syntax-object-is-properly-certified function somewhere?

Kimberley Burchett

Posted on the users mailing list.