diff --git a/collects/mzlib/unit.rkt b/collects/mzlib/unit.rkt index cd342989c5..8f18c8fa1c 100644 --- a/collects/mzlib/unit.rkt +++ b/collects/mzlib/unit.rkt @@ -1684,7 +1684,7 @@ (((wrap-code ...) ...) (map (λ (os ov tbs) (define rename-bindings - (get-member-bindings def-table os #'(quote-module-path))) + (get-member-bindings def-table os #'(quote-module-name))) (map (λ (tb i v c) (if c (with-syntax ([ctc-stx diff --git a/collects/racket/contract/private/arr-i.rkt b/collects/racket/contract/private/arr-i.rkt index 7e40dda29b..32c0b546b4 100644 --- a/collects/racket/contract/private/arr-i.rkt +++ b/collects/racket/contract/private/arr-i.rkt @@ -786,7 +786,7 @@ keywordlist #'(scname ...)))] [stxclass (in-list (attribute scname.value))] [rec (in-list (attribute c.rec))]) diff --git a/collects/syntax/scribblings/srcloc.scrbl b/collects/syntax/scribblings/srcloc.scrbl index 61e7bddb5d..803c0accf9 100644 --- a/collects/syntax/scribblings/srcloc.scrbl +++ b/collects/syntax/scribblings/srcloc.scrbl @@ -2,7 +2,8 @@ @(require scribble/eval (for-label racket/base syntax/srcloc - syntax/location)) + syntax/location + setup/path-to-relative)) @(define unsyntax #f) @@ -290,43 +291,63 @@ the whole macro application if no @racket[form] is given. } -@deftogether[( -@defform[(quote-module-name)] -@defform[(quote-module-path)] -)]{ +@defform[(quote-module-name)]{ -Quote the name of the module in which the form is compiled. The -@racket[quote-module-name] form produces a string or a symbol, while -@racket[quote-module-path] produces a @tech[#:doc reference-path]{module path}. - -These forms use relative names for modules found in the collections or PLaneT -cache; their results are suitable for printing, but not for accessing libraries -programmatically, such as via @racket[dynamic-require]. +Quotes the name of the module in which the form is compiled as a path or symbol, +or @racket['top-level] when used outside of a module. To produce a name +suitable for use in printed messages, apply +@racket[path->relative-string/library] when the result is a path. @defexamples[#:eval (new-evaluator) (module A racket (require syntax/location) (define-syntax-rule (name) (quote-module-name)) - (define-syntax-rule (path) (quote-module-path)) (define a-name (name)) - (define a-path (path)) (provide (all-defined-out))) (require 'A) a-name -a-path (module B racket (require syntax/location) (require 'A) (define b-name (name)) - (define b-path (path)) (provide (all-defined-out))) (require 'B) b-name -b-path (quote-module-name) -(quote-module-path) [current-namespace (module->namespace (quote 'A))] (quote-module-name) +] + +} + +@defform[(quote-module-path)]{ + +@emph{This form is deprecated, as it does not produce module paths that reliably +indicate collections or PLaneT packages. Please use @racket[quote-module-name] +and @racket[path->relative-string/library] to produce human-readable module +names in printed messages.} + +Quotes the name of the module in which the form is compiled as a +@tech[#:doc reference-path]{module path} using @racket[quote] or @racket[file], +or produces @racket['top-level] when used outside of a module. + +@defexamples[#:eval (new-evaluator) +(module A racket + (require syntax/location) + (define-syntax-rule (path) (quote-module-path)) + (define a-path (path)) + (provide (all-defined-out))) +(require 'A) +a-path +(module B racket + (require syntax/location) + (require 'A) + (define b-path (path)) + (provide (all-defined-out))) +(require 'B) +b-path +(quote-module-path) +[current-pathspace (module->pathspace (quote 'A))] (quote-module-path) ] diff --git a/collects/typed-scheme/typecheck/tc-toplevel.rkt b/collects/typed-scheme/typecheck/tc-toplevel.rkt index 5bbb4a6e0f..e143bcb9e6 100644 --- a/collects/typed-scheme/typecheck/tc-toplevel.rkt +++ b/collects/typed-scheme/typecheck/tc-toplevel.rkt @@ -310,7 +310,7 @@ #`(begin #,(if (null? (syntax-e #'(new-provs ...))) #'(begin) - #'(define the-variable-reference (quote-module-path))) + #'(define the-variable-reference (quote-module-name))) #,(env-init-code syntax-provide? provide-tbl def-tbl) #,(tname-env-init-code) #,(talias-env-init-code) diff --git a/collects/unstable/wrapc.rkt b/collects/unstable/wrapc.rkt index e80c88f235..4407da72f8 100644 --- a/collects/unstable/wrapc.rkt +++ b/collects/unstable/wrapc.rkt @@ -40,7 +40,7 @@ [_ #f])] [else #f])]) (base-wrap-expr/c expr ctc-expr - #:positive #'(quote-module-path) + #:positive #'(quote-module-name) #:negative neg-source-expr #:expr-name (cond [(and expr-name macro-name) (format "~a of ~a" expr-name macro-name)] @@ -64,7 +64,7 @@ (define (get-source-expr source ctx) (cond [(eq? source 'use-site) - #'(quote-module-path)] + #'(quote-module-name)] [(eq? source 'unknown) #'(quote "unknown")] [(eq? source 'from-macro)