[plt-scheme] tracing procedures defined in module
Yin-So Chen wrote:
> Hi -
>
> how can I trace a procedure defined inside a module? Below is an example:
>
> > (require (lib "trace.ss"))
> > (require (lib "process.ss"))
> > (trace system*)
> set!: cannot mutate module-required variable in: system*
>
> I try to keep my own code modular during development, but the
> limitation appears to be a hindrance when trace is unable to help me
> discern what's going on. Are there ways to get around this
> limitation? I discover this to be a design choice at
> http://hkn.eecs.berkeley.edu/~dyoo/plt/modules.text
> <http://hkn.eecs.berkeley.edu/%7Edyoo/plt/modules.text>.
>
This is what I did once in lieu of not being able to mutate module
variables. Its probably not the best way, someone can critique it later
but it seems to work. And you can always make a macro to do all this
stuff for you.
(module foo mzscheme
(provide blah)
(define (blah x)
(add1 x))
)
(require (lib "trace.ss"))
(require (prefix f: foo))
(define blah f:blah)
(trace blah)
(blah 2)
$ mzscheme -f y.ss
Welcome to MzScheme version 360, Copyright (c) 2004-2006 PLT Scheme Inc.
|(blah 2)
|3
>