Yes, I don't really want #%top per se. My scenario is to "alias" an imported id (i.e. not something privately defined by the module) and it looks more like below:<br><br>> (module foo mzscheme <br> (define bar (lambda (x) x))
<br> (provide bar))<br>> (begin <br> (require (prefix baz: foo))<br> (define bar baz:bar))<br>> baz:bar<br>#<procedure:bar><br>> bar<br>#<procedure:bar><br><br>Aliasing allow me to "trace" and set over the alias (
<a href="http://list.cs.brown.edu/pipermail/plt-scheme/2007-March/016927.html" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">http://list.cs.brown.edu/pipermail/plt-scheme/2007-March/016927.html</a>
). So I extracted the exported variables for a module (<a href="http://list.cs.brown.edu/pipermail/plt-scheme/2003-November/003698.html">http://list.cs.brown.edu/pipermail/plt-scheme/2003-November/003698.html</a>) and attempt to do write a macro that would automatically alias them, but all of the variables gets expanded to (#%top . variable) form, while if I manually write it out like above, it is "ok".
<br><br>Reading the manual it says that unbound variables would automatically gets expanded to (#%top . var) form. Anyway to prevent it from expanding to the form? <br><br>Thanks,<br>yinso <br><br><br><div><span class="gmail_quote">
On 4/23/07, <b class="gmail_sendername">Matthew Flatt</b> <<a href="mailto:mflatt@cs.utah.edu" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">mflatt@cs.utah.edu</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
At Mon, 23 Apr 2007 16:45:25 -0700, "Yin-So Chen" wrote:<br>> What is the difference with respect to imported bindings and local<br>> bindings? I notice that imported binding cannot be expanded via #%top?
<br><br>`#%top' always refers to a definition outside of a module.<br><br>> In syntax a define often gets expanded to (#%top . id) form, so how can I<br>> write<br>><br>> #'(define local-id imported-id)
<br>><br>> Given that the above gets expanded to<br>><br>> #'(define-values (local-id) (#%top . imported-id))<br><br>If I understand, you don't really want `#%top'. Instead, you want the<br>binding that `imported-id' would have if it appeared at the top level
<br>of its enclosing module (or at the plain top level, if the definition<br>appears outside of a module).<br><br>There's no way to do that right now (I think).<br><br>In fact, if there was a way to do that, then depending on how it
<br>worked, I think it might open a kind of security hole: a macro might<br>expand to `(let ([x ....]) .... (<untrusted-thing> x))' where the<br>enclosing module also defines a top-level `x' that is supposed to
<br>remain private. If `<untrusted-thing>' turned out to be a macro that<br>find the module-top-level binding of `x', maybe it could get at the<br>private `x'. Or maybe the relevant operations could be defined to
<br>prevent that sort of thing; I'm not sure.<br><br>Matthew<br><br></blockquote></div><br><br clear="all"><br>-- <br><a href="http://www.yinsochen.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
http://www.yinsochen.com</a><br>...continuous learning...