diff --git a/collects/drscheme/private/module-language.ss b/collects/drscheme/private/module-language.ss index c1b4601974..fcd545f5bd 100644 --- a/collects/drscheme/private/module-language.ss +++ b/collects/drscheme/private/module-language.ss @@ -203,9 +203,10 @@ (namespace-require lang)) (check-interactive-language)) (define (*init) - ;; the prompt makes it continue after an error - (call-with-continuation-prompt - (λ () (dynamic-require modspec #f))) + (parameterize ([current-namespace (current-namespace)]) + ;; the prompt makes it continue after an error + (call-with-continuation-prompt + (λ () (dynamic-require modspec #f)))) (current-namespace (module->namespace modspec)) (check-interactive-language)) ;; here's where they're all combined with the module expression diff --git a/collects/tests/drscheme/module-lang-test.ss b/collects/tests/drscheme/module-lang-test.ss index d13ca363b7..ad6748ddd3 100644 --- a/collects/tests/drscheme/module-lang-test.ss +++ b/collects/tests/drscheme/module-lang-test.ss @@ -219,11 +219,29 @@ " support a REPL \\(no #%top-interaction\\)\n*$")) #t) +;; test scheme/load behavior (test @t{#lang scheme/load (module m mzscheme (provide x) (define x 2)) (require 'm) (printf "~s\n" x) (flush-output)} #f - @t{2}) + "2") +(test @t{#lang scheme/load + (module m mzscheme (provide x) (define x 2)) + (module n scheme/base (require 'm) (provide y) (define y (* x x))) + (require 'n) + (printf "~s\n" y) + (flush-output)} + #f + "4") +;; test protection against user-code changing the namespace +(test @t{#lang scheme/base + (current-namespace (make-base-namespace))} + "(+ 1 2)" + "3") +(test @t{#lang scheme/base + (current-namespace (make-base-empty-namespace))} + "(+ 1 2)" + "3")