[plt-scheme] difference between imported definition versus locally defined definitions?
At Mon, 23 Apr 2007 16:45:25 -0700, "Yin-So Chen" wrote:
> What is the difference with respect to imported bindings and local
> bindings? I notice that imported binding cannot be expanded via #%top?
`#%top' always refers to a definition outside of a module.
> In syntax a define often gets expanded to (#%top . id) form, so how can I
> write
>
> #'(define local-id imported-id)
>
> Given that the above gets expanded to
>
> #'(define-values (local-id) (#%top . imported-id))
If I understand, you don't really want `#%top'. Instead, you want the
binding that `imported-id' would have if it appeared at the top level
of its enclosing module (or at the plain top level, if the definition
appears outside of a module).
There's no way to do that right now (I think).
In fact, if there was a way to do that, then depending on how it
worked, I think it might open a kind of security hole: a macro might
expand to `(let ([x ....]) .... (<untrusted-thing> x))' where the
enclosing module also defines a top-level `x' that is supposed to
remain private. If `<untrusted-thing>' turned out to be a macro that
find the module-top-level binding of `x', maybe it could get at the
private `x'. Or maybe the relevant operations could be defined to
prevent that sort of thing; I'm not sure.
Matthew