<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On Oct 27, 2014, at 7:00 PM, Dan Liebgold wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div dir="ltr"><div>I have a namespace behind a particular API. I'd love to hook into the module system to control compilation, visibility, etc. of all the definitions and references.</div><div><br></div><div>Here's an example. 'a' is available in the top level module even though it was defined by module 'm1' and not provided by any explicit mechanism. (Also, order dependencies seem imminent.)</div></div></blockquote><div><br></div><div>Since you didn't reply to Jay's response, let me resume the thread. You had written not quite this: </div><div><br></div><blockquote type="cite"><div dir="ltr"><div><span class="Apple-style-span" style="font-family: 'courier new', monospace; ">#lang racket</span></div></div></blockquote><div><font class="Apple-style-span" color="#1755ca" face="'courier new', monospace"><br></font></div><div><font class="Apple-style-span" color="#1755ca" face="'courier new', monospace">(module base racket</font></div><div><font class="Apple-style-span" color="#1755ca" face="'courier new', monospace"> (define my-table (make-hasheq))</font></div><div><font class="Apple-style-span" color="#1755ca" face="'courier new', monospace"> </font></div><div><font class="Apple-style-span" color="#1755ca" face="'courier new', monospace"> (define-syntax (my-define stx)</font></div><div><font class="Apple-style-span" color="#1755ca" face="'courier new', monospace"> (syntax-case stx ()</font></div><div><font class="Apple-style-span" color="#1755ca" face="'courier new', monospace"> [(_ my-id expr) (identifier? #'my-id)</font></div><div><font class="Apple-style-span" color="#1755ca" face="'courier new', monospace"> #'(hash-set! my-table 'my-id expr)]))</font></div><div><font class="Apple-style-span" color="#1755ca" face="'courier new', monospace"> </font></div><div><font class="Apple-style-span" color="#1755ca" face="'courier new', monospace"> (define-syntax (my-eval stx)</font></div><div><font class="Apple-style-span" color="#1755ca" face="'courier new', monospace"> (syntax-case stx ()</font></div><div><font class="Apple-style-span" color="#1755ca" face="'courier new', monospace"> [(_ my-id)</font></div><div><font class="Apple-style-span" color="#1755ca" face="'courier new', monospace"> #'(hash-ref my-table 'my-id #f)])) ;; <--- my first change </font></div><div><font class="Apple-style-span" color="#1755ca" face="'courier new', monospace"> </font></div><div><font class="Apple-style-span" color="#1755ca" face="'courier new', monospace"> (provide my-define my-eval))</font></div><div><font class="Apple-style-span" color="#1755ca" face="'courier new', monospace"><br></font></div><div><font class="Apple-style-span" color="#1755ca" face="'courier new', monospace">(module m1 racket</font></div><div><font class="Apple-style-span" color="#1755ca" face="'courier new', monospace"> (require (submod ".." base))</font></div><div><font class="Apple-style-span" color="#1755ca" face="'courier new', monospace"> (my-define a (+ 1 2)))</font></div><div><font class="Apple-style-span" color="#1755ca" face="'courier new', monospace"><br></font></div><div><font class="Apple-style-span" color="#1755ca" face="'courier new', monospace">(require 'base 'm1)</font></div><div><font class="Apple-style-span" color="#1755ca" face="'courier new', monospace"><br></font></div><div><font class="Apple-style-span" color="#1755ca" face="'courier new', monospace">(my-eval a) ;; <--- my second change </font></div><div><font class="Apple-style-span" color="#1755ca" face="'courier new', monospace"><br></font></div><div><font class="Apple-style-span" color="#1755ca" face="'courier new', monospace"><br></font></div><div><font class="Apple-style-span" color="#1755ca" face="'courier new', monospace">;; --- </font></div><div><font class="Apple-style-span" color="#1755ca" face="'courier new', monospace"><br></font></div><div><font class="Apple-style-span" color="#1755ca" face="'courier new', monospace">When you write 'a' is available in the top-level module, even though you didn't import it, I don't see it. You imported all of base into the top level and m1. These imports include accessors to 'my-table' and 'm1' happened to store a key in this table. Why should you not be able to retrieve the value of 'a'? </font></div><div><font class="Apple-style-span" color="#1755ca" face="'courier new', monospace"><br></font></div><div><font class="Apple-style-span" color="#1755ca" face="'courier new', monospace">-- Matthias</font></div><div><font class="Apple-style-span" color="#1755ca" face="'courier new', monospace"><br></font></div><div><font class="Apple-style-span" color="#1755ca" face="'courier new', monospace"><br></font></div><div><br></div></div><br></body></html>