[plt-scheme] repl and namespaces

From: Peter Santoro (peter at pscomp.com)
Date: Mon Feb 10 08:32:40 EST 2003

My application is using customized REPLs as its interface.  So far, 
things are working fine.  Here is an abbreviated example of my main-repl:

(define (main-repl)
   (let ((ch (prompt-for-char (main-prompt) #f)))
     (cond ((eq? ch #\q) (newline))
           ((eq? ch #\p) (project-repl) (main-repl))
           ((eq? ch #\D) (debug-repl) (main-repl))
           ((eq? ch #\?) (main-help) (main-repl))
           (else (main-repl)))))

Note that I would like to be able to hot key into scheme's REPL for 
debugging.  The following debug-repl works if I type in (exit) or 
(quit), but doesn't recognize any of my modules' symbols during eval.  I 
believe I have a namespace issue.

(define (debug-repl)
   (display "\ndebug> ")
   (let ((expr (read)))
     (cond ((or (equal? expr '(exit)) (equal? expr '(quit))) (newline))
           (else (display (eval expr))(debug-repl)))))

The mzscheme docs do discuss REPL and namespaces, but some additional 
samples or pointers to them would be helpful in allowing me to better 
understanding these aspects of mzscheme's implementation.

My questions:

1) Are there better ways to write customized REPLs in mzscheme, perhaps 
via (parameterize .... (read-eval-print-loop))?

2) How do I call scheme's REPL with my modules' symbols loaded, perhaps 
use (namespace-require (require ...)) somehow?

3) Where can I find additional samples of the above?

Thank you,


Posted on the users mailing list.