[plt-scheme] Interacting w/ MzScheme
On Fri, 10 Dec 2004 12:48:28 -0600, Pinku Surana <suranap at gmail.com> wrote:
> What magic incantation will erase MzScheme's state without
> restarting? DrScheme somehow does this.
I'm not sure if this is how DrScheme does it, but try this:
$ cat bah.ss
(module bah mzscheme
(printf "bah!~n"))
$ mzscheme
Welcome to MzScheme version 299.22, Copyright (c) 2004 PLT Scheme, Inc.
> (define ns1 (make-namespace 'initial))
> (define ns2 (make-namespace 'initial))
> (eval '(require "bah.ss") ns1)
bah!
> (eval '(require "bah.ss") ns1)
> (eval '(require "bah.ss") ns2)
bah!
So...
$ mzscheme
Welcome to MzScheme version 299.22, Copyright (c) 2004 PLT Scheme, Inc.
> (define (repl)
(printf "~n>> ")
(print (eval (read)))
(repl))
> (define (toplevel)
(let/ec ec
(parameterize ([current-namespace (make-namespace 'initial)])
(namespace-set-variable-value! 'exit (lambda () (ec #f)))
(repl))))
> (toplevel)
>> 8
8
>> 9
9
>> (exit)
#f
> (toplevel)
>> (require "bah.ss")
bah!
>> (require "bah.ss")
>> (exit)
#f
> (toplevel)
>> (require "bah.ss")
bah!
>> (require "bah.ss")
>>
Daniel