[plt-scheme] difference between imported definition versus locally defined definitions?

From: Yin-So Chen (yinso.chen at gmail.com)
Date: Mon Apr 30 14:19:11 EDT 2007

Thanks Matt - this is very good tip! ;)

Appreciated,
yinso

On 4/29/07, Matthew Flatt <mflatt at cs.utah.edu> wrote:
>
> After finally stepping back to try to see what you're after, I think
> maybe you want to work in something like the following mode:
>
> > (compile-enforce-module-constants #f)
> > (module foo mzscheme
>      (define bar (lambda (x) x))
>      (provide bar))
> > (require foo)
> > (bar 10)
> 10
> ;; decide to explore `bar' some more...
> > (current-namespace (module->namespace 'foo))
> > (require (lib "trace.ss"))
> > (trace bar)
> (bar)
> > (bar 10)
> |(bar 10)
> |10
> 10
> >
>
> That is, to perform debugging tasks like `trace'ing a module binding,
> switch to a namespace that reflects the module's content where `trace'
> can work (as long as module constants are not enforced up front).
>
> If that's not exactly right, I still imagine that you're trying to
> create a debugging tool, and so reflective operations like
> `module->namespace' and even `eval' are maybe the right starting
> points, instead of `#%top'.
>
> Matthew
>
> At Mon, 23 Apr 2007 21:05:46 -0700, "Yin-So Chen" wrote:
> > 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:
> >
> > > (module foo mzscheme
> >     (define bar (lambda (x) x))
> >     (provide bar))
> > > (begin
> >     (require (prefix baz: foo))
> >     (define bar baz:bar))
> > > baz:bar
> > #<procedure:bar>
> > > bar
> > #<procedure:bar>
> >
> > Aliasing allow me to "trace" and set over the alias (
> > http://list.cs.brown.edu/pipermail/plt-scheme/2007-March/016927.html).  So
> I
> > extracted the exported variables for a module (
> > http://list.cs.brown.edu/pipermail/plt-scheme/2003-November/003698.html)
> 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".
>
>
>


-- 
http://www.yinsochen.com
...continuous learning...
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20070430/91e32876/attachment.html>

Posted on the users mailing list.