Corrected documentation of quote-module-name to indicate that it does not

produce collection and planet-relative paths on its own.  Deprecated
quote-module-path, and replaced existing uses of it with quote-module-name.
(cherry picked from commit 2e6a608539)
This commit is contained in:
Carl Eastlund 2011-07-09 14:46:58 -04:00 committed by Eli Barzilay
parent bc607e96e9
commit 0911365403
8 changed files with 48 additions and 27 deletions

View File

@ -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

View File

@ -786,7 +786,7 @@
keyword<?)
#,(and (istx-rst an-istx) #t)
#,(and (syntax-parameter-value #'making-a-method) #t)
(quote-module-path)
(quote-module-name)
#,wrapper-func
'#(#,(for/list ([an-arg (in-list (istx-args an-istx))])
`(,(if (arg/res-vars an-arg) 'dep 'nodep)

View File

@ -24,7 +24,7 @@ improve method arity mismatch contract violation error messages?
"misc.rkt")
(define-syntax-parameter current-contract-region
(λ (stx) #'(quote-module-path)))
(λ (stx) #'(quote-module-name)))
(define-syntax (contract stx)
(syntax-case stx ()

View File

@ -74,7 +74,7 @@
#`(contract contract-id
id
pos-module-source
(quote-module-path)
(quote-module-name)
'external-id
#,srcloc-code))))))])
(when key (hash-set! saved-id-table key lifted-id))
@ -687,7 +687,7 @@
(syntax-property
(quasisyntax/loc stx
(begin
(define pos-module-source (quote-module-path))
(define pos-module-source (quote-module-name))
#,@(if no-need-to-check-ctrct?
(list)

View File

@ -137,7 +137,7 @@
[(_ [scname c:stxclass-ctc] ...)
#:declare scname (static stxclass? "syntax class")
(parameterize ((current-syntax-context stx))
#`(begin (define pos-module-source (quote-module-path))
#`(begin (define pos-module-source (quote-module-name))
#,@(for/list ([scname (in-list (syntax->list #'(scname ...)))]
[stxclass (in-list (attribute scname.value))]
[rec (in-list (attribute c.rec))])

View File

@ -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)
]

View File

@ -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)

View File

@ -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)