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.
This commit is contained in:
parent
584a96a4e0
commit
2e6a608539
|
@ -1684,7 +1684,7 @@
|
||||||
(((wrap-code ...) ...)
|
(((wrap-code ...) ...)
|
||||||
(map (λ (os ov tbs)
|
(map (λ (os ov tbs)
|
||||||
(define rename-bindings
|
(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)
|
(map (λ (tb i v c)
|
||||||
(if c
|
(if c
|
||||||
(with-syntax ([ctc-stx
|
(with-syntax ([ctc-stx
|
||||||
|
|
|
@ -786,7 +786,7 @@
|
||||||
keyword<?)
|
keyword<?)
|
||||||
#,(and (istx-rst an-istx) #t)
|
#,(and (istx-rst an-istx) #t)
|
||||||
#,(and (syntax-parameter-value #'making-a-method) #t)
|
#,(and (syntax-parameter-value #'making-a-method) #t)
|
||||||
(quote-module-path)
|
(quote-module-name)
|
||||||
#,wrapper-func
|
#,wrapper-func
|
||||||
'#(#,(for/list ([an-arg (in-list (istx-args an-istx))])
|
'#(#,(for/list ([an-arg (in-list (istx-args an-istx))])
|
||||||
`(,(if (arg/res-vars an-arg) 'dep 'nodep)
|
`(,(if (arg/res-vars an-arg) 'dep 'nodep)
|
||||||
|
|
|
@ -24,7 +24,7 @@ improve method arity mismatch contract violation error messages?
|
||||||
"misc.rkt")
|
"misc.rkt")
|
||||||
|
|
||||||
(define-syntax-parameter current-contract-region
|
(define-syntax-parameter current-contract-region
|
||||||
(λ (stx) #'(quote-module-path)))
|
(λ (stx) #'(quote-module-name)))
|
||||||
|
|
||||||
(define-syntax (contract stx)
|
(define-syntax (contract stx)
|
||||||
(syntax-case stx ()
|
(syntax-case stx ()
|
||||||
|
|
|
@ -74,7 +74,7 @@
|
||||||
#`(contract contract-id
|
#`(contract contract-id
|
||||||
id
|
id
|
||||||
pos-module-source
|
pos-module-source
|
||||||
(quote-module-path)
|
(quote-module-name)
|
||||||
'external-id
|
'external-id
|
||||||
#,srcloc-code))))))])
|
#,srcloc-code))))))])
|
||||||
(when key (hash-set! saved-id-table key lifted-id))
|
(when key (hash-set! saved-id-table key lifted-id))
|
||||||
|
@ -687,7 +687,7 @@
|
||||||
(syntax-property
|
(syntax-property
|
||||||
(quasisyntax/loc stx
|
(quasisyntax/loc stx
|
||||||
(begin
|
(begin
|
||||||
(define pos-module-source (quote-module-path))
|
(define pos-module-source (quote-module-name))
|
||||||
|
|
||||||
#,@(if no-need-to-check-ctrct?
|
#,@(if no-need-to-check-ctrct?
|
||||||
(list)
|
(list)
|
||||||
|
|
|
@ -137,7 +137,7 @@
|
||||||
[(_ [scname c:stxclass-ctc] ...)
|
[(_ [scname c:stxclass-ctc] ...)
|
||||||
#:declare scname (static stxclass? "syntax class")
|
#:declare scname (static stxclass? "syntax class")
|
||||||
(parameterize ((current-syntax-context stx))
|
(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 ...)))]
|
#,@(for/list ([scname (in-list (syntax->list #'(scname ...)))]
|
||||||
[stxclass (in-list (attribute scname.value))]
|
[stxclass (in-list (attribute scname.value))]
|
||||||
[rec (in-list (attribute c.rec))])
|
[rec (in-list (attribute c.rec))])
|
||||||
|
|
|
@ -2,7 +2,8 @@
|
||||||
@(require scribble/eval
|
@(require scribble/eval
|
||||||
(for-label racket/base
|
(for-label racket/base
|
||||||
syntax/srcloc
|
syntax/srcloc
|
||||||
syntax/location))
|
syntax/location
|
||||||
|
setup/path-to-relative))
|
||||||
|
|
||||||
@(define unsyntax #f)
|
@(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-name)]
|
|
||||||
@defform[(quote-module-path)]
|
|
||||||
)]{
|
|
||||||
|
|
||||||
Quote the name of the module in which the form is compiled. The
|
Quotes the name of the module in which the form is compiled as a path or symbol,
|
||||||
@racket[quote-module-name] form produces a string or a symbol, while
|
or @racket['top-level] when used outside of a module. To produce a name
|
||||||
@racket[quote-module-path] produces a @tech[#:doc reference-path]{module path}.
|
suitable for use in printed messages, apply
|
||||||
|
@racket[path->relative-string/library] when the result is a 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].
|
|
||||||
|
|
||||||
@defexamples[#:eval (new-evaluator)
|
@defexamples[#:eval (new-evaluator)
|
||||||
(module A racket
|
(module A racket
|
||||||
(require syntax/location)
|
(require syntax/location)
|
||||||
(define-syntax-rule (name) (quote-module-name))
|
(define-syntax-rule (name) (quote-module-name))
|
||||||
(define-syntax-rule (path) (quote-module-path))
|
|
||||||
(define a-name (name))
|
(define a-name (name))
|
||||||
(define a-path (path))
|
|
||||||
(provide (all-defined-out)))
|
(provide (all-defined-out)))
|
||||||
(require 'A)
|
(require 'A)
|
||||||
a-name
|
a-name
|
||||||
a-path
|
|
||||||
(module B racket
|
(module B racket
|
||||||
(require syntax/location)
|
(require syntax/location)
|
||||||
(require 'A)
|
(require 'A)
|
||||||
(define b-name (name))
|
(define b-name (name))
|
||||||
(define b-path (path))
|
|
||||||
(provide (all-defined-out)))
|
(provide (all-defined-out)))
|
||||||
(require 'B)
|
(require 'B)
|
||||||
b-name
|
b-name
|
||||||
b-path
|
|
||||||
(quote-module-name)
|
(quote-module-name)
|
||||||
(quote-module-path)
|
|
||||||
[current-namespace (module->namespace (quote 'A))]
|
[current-namespace (module->namespace (quote 'A))]
|
||||||
(quote-module-name)
|
(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)
|
(quote-module-path)
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
|
@ -310,7 +310,7 @@
|
||||||
#`(begin
|
#`(begin
|
||||||
#,(if (null? (syntax-e #'(new-provs ...)))
|
#,(if (null? (syntax-e #'(new-provs ...)))
|
||||||
#'(begin)
|
#'(begin)
|
||||||
#'(define the-variable-reference (quote-module-path)))
|
#'(define the-variable-reference (quote-module-name)))
|
||||||
#,(env-init-code syntax-provide? provide-tbl def-tbl)
|
#,(env-init-code syntax-provide? provide-tbl def-tbl)
|
||||||
#,(tname-env-init-code)
|
#,(tname-env-init-code)
|
||||||
#,(talias-env-init-code)
|
#,(talias-env-init-code)
|
||||||
|
|
|
@ -40,7 +40,7 @@
|
||||||
[_ #f])]
|
[_ #f])]
|
||||||
[else #f])])
|
[else #f])])
|
||||||
(base-wrap-expr/c expr ctc-expr
|
(base-wrap-expr/c expr ctc-expr
|
||||||
#:positive #'(quote-module-path)
|
#:positive #'(quote-module-name)
|
||||||
#:negative neg-source-expr
|
#:negative neg-source-expr
|
||||||
#:expr-name (cond [(and expr-name macro-name)
|
#:expr-name (cond [(and expr-name macro-name)
|
||||||
(format "~a of ~a" expr-name macro-name)]
|
(format "~a of ~a" expr-name macro-name)]
|
||||||
|
@ -64,7 +64,7 @@
|
||||||
|
|
||||||
(define (get-source-expr source ctx)
|
(define (get-source-expr source ctx)
|
||||||
(cond [(eq? source 'use-site)
|
(cond [(eq? source 'use-site)
|
||||||
#'(quote-module-path)]
|
#'(quote-module-name)]
|
||||||
[(eq? source 'unknown)
|
[(eq? source 'unknown)
|
||||||
#'(quote "unknown")]
|
#'(quote "unknown")]
|
||||||
[(eq? source 'from-macro)
|
[(eq? source 'from-macro)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user