adjusted the way the teaching languages work so that signature

violations in the REPL are tracked.
This commit is contained in:
Robby Findler 2010-10-07 14:27:56 -05:00
parent 058c05258e
commit fed1e3dc3e
2 changed files with 24 additions and 1 deletions

View File

@ -19,6 +19,7 @@
compiler/embed compiler/embed
wxme/wxme wxme/wxme
setup/dirs setup/dirs
test-engine/racket-tests
;; this module is shared between the drscheme's namespace (so loaded here) ;; this module is shared between the drscheme's namespace (so loaded here)
;; and the user's namespace in the teaching languages ;; and the user's namespace in the teaching languages
@ -547,6 +548,22 @@
(get-module) (get-module)
(htdp-lang-settings-teachpacks settings) (htdp-lang-settings-teachpacks settings)
(drscheme:rep:current-rep))) (drscheme:rep:current-rep)))
(define/override (front-end/interaction port settings)
(let ([t (super front-end/interaction port settings)]
[done? #f])
(λ ()
(cond
[done? eof]
[else
(let ([ans (t)])
(cond
[(eof-object? ans)
(set! done? #t)
#`(test)]
[else
ans]))]))))
(define keywords #f) (define keywords #f)
(define/augment (capability-value key) (define/augment (capability-value key)

View File

@ -59,7 +59,13 @@
,@(map (λ (x) `(require ,x)) teachpacks) ,@(map (λ (x) `(require ,x)) teachpacks)
,@body-exps ,@body-exps
,@(if enable-testing? ,@(if enable-testing?
(if (null? body-exps) '() `((,#'test))) (if (null? body-exps)
'()
;; this definition pulls the test~object binding from the user's namespace
;; over to the one that is used in the REPL when module->namepsace
;; grabs a hold of this module to make a namespace for the REPL
`(,#'(define test~object (namespace-variable-value 'test~object))
(,#'test)))
'())))) '()))))
rep)))] rep)))]
[(require) [(require)