我已经用Racket(以前称为PLT Scheme)构建了一个相当复杂的应用程序,并且希望为调试目的添加REPL。我试图让它通过TCP流访问:通过TCP的球拍REPL
(define repl-server
(thread (lambda()
(let ((listener (tcp-listen 8082 5 #t)))
(do() (#f)
(let-values (((in out) (tcp-accept listener)))
(thread (lambda()
(let ((port-string (get-port-string in)))
(Try "debug-repl" #f
(begin
(file-stream-buffer-mode out 'line)
(display-and-log "Password: " out)
(flush-output out)
(when (string=? (read-line in) "whatever")
(log "Connect to REPL: " port-string))
(current-input-port in)
(current-output-port out)
(current-error-port out)
(read-eval-print-loop))
(close-input-port in)
(close-output-port out))))))))))))
(Try name result-if-exception form)
是提供基本的异常处理的宏,(日志...)和(显示和记录...)?他们什么声音喜欢。
现在,如果我访问REPL,我甚至不能评估常量,因为我不断收到错误compile: unbound identifier (and no #%app syntax transformer is bound) at: #%top-interaction
。我怎样才能让这个REPL工作?在启动REPL服务器之前,如何访问值define
d?
大问题!你真的应该在球拍邮件列表http://lists.racket-lang.org/users/上提出这个问题。我可以预测以下几点:1)有办法做到这一点。 2)可能会很痛苦。 3)你可能想看看沙箱。 – 2011-05-10 07:23:05
注意自我:下次使用'addlog'或类似的名称作为该功能的名称... – lbruder 2011-05-10 07:57:50