Error messages for using places with symbol module paths

This commit is contained in:
Kevin Tew 2011-08-31 12:14:16 -06:00
parent 6e2487bffa
commit 261f002ce2
3 changed files with 9 additions and 4 deletions

View File

@ -147,8 +147,7 @@
(syntax-case stx () (syntax-case stx ()
[(_ ch body1 body ...) [(_ ch body1 body ...)
(begin (begin
;breaks valid uses of place #;(when (in-module-expansion?)
#;(unless (eq? 'module (syntax-local-context))
(raise-syntax-error #f "can only be used in a module" stx)) (raise-syntax-error #f "can only be used in a module" stx))
(unless (identifier? #'ch) (unless (identifier? #'ch)
(raise-syntax-error #f "expected an indentifier" stx #'ch)) (raise-syntax-error #f "expected an indentifier" stx #'ch))
@ -165,6 +164,7 @@
(resolved-module-path-name (resolved-module-path-name
(variable-reference->resolved-module-path (variable-reference->resolved-module-path
vr))) vr)))
(dynamic-place (if (symbol? name) `',name name) (when (symbol? name)
func-name)) (error 'place "the current module-path-name should be a path and not a symbol (if you are in DrRacket, save the file)"))
(dynamic-place name func-name))

View File

@ -5,6 +5,8 @@
(place-wait (place/base (p1 ch) (place-wait (place/base (p1 ch)
(printf "Hello from place\n"))) (printf "Hello from place\n")))
(err/rt-test (dynamic-place 'tmodule 'tfunc))
(let ([p (place/base (p1 ch) (let ([p (place/base (p1 ch)
(printf "Hello form place 2\n") (printf "Hello form place 2\n")
(exit 99))]) (exit 99))])

View File

@ -227,6 +227,9 @@ Scheme_Object *scheme_place(int argc, Scheme_Object *args[]) {
if (!scheme_is_module_path(args[0]) && !SCHEME_PATHP(args[0])) { if (!scheme_is_module_path(args[0]) && !SCHEME_PATHP(args[0])) {
scheme_wrong_type("dynamic-place", "module-path or path", 0, argc, args); scheme_wrong_type("dynamic-place", "module-path or path", 0, argc, args);
} }
if (SCHEME_SYMBOLP(args[0])) {
scheme_wrong_type("dynamic-place", "non-symbol module-path", 0, argc, args);
}
if (!SCHEME_SYMBOLP(args[1])) { if (!SCHEME_SYMBOLP(args[1])) {
scheme_wrong_type("dynamic-place", "symbol", 1, argc, args); scheme_wrong_type("dynamic-place", "symbol", 1, argc, args);
} }