document `define-runtime-path' limitation

Also, log a warning when it is used in a position where it
doesn't work rght with the executable creator. I didn't make
this case an error, because `define-runtime-path' can still
work in that case as long as no standalone executable needs
to be created.
This commit is contained in:
Matthew Flatt 2012-11-11 07:44:04 -07:00
parent a6cfe3d5fb
commit 50af874a7a
2 changed files with 15 additions and 0 deletions

View File

@ -158,6 +158,12 @@
#'orig-stx
id)))
ids)
(let ([phase (sub1 (variable-reference->phase (#%variable-reference)))])
(unless (zero? phase)
(log-warning "warning: ~a: at phase level ~a: ~e"
(syntax-e (syntax-case #'orig-stx () [(id . _) #'id]))
phase
#'orig-stx)))
#`(begin
(define-values (id ...)
(let-values ([(id ...) expr])

View File

@ -536,6 +536,15 @@ If a path is needed only on some platforms and not on others, use
@racket[define-runtime-path-list] with an @racket[expr] that produces an
empty list on platforms where the path is not needed.
Beware that @racket[define-runtime-path] in a @tech{phase level} other
than 0 does not cooperate properly with an executable creator. To work
around that limitation, put @racket[define-runtime-path] in a separate
module---perhaps a @tech{submodule} created by @racket[module]---then
export the definition, and then the module containing the definition
can be @racket[require]d into any phase level. Using
@racket[define-runtime-path] in a @tech{phase level} other than 0
logs a warning at expansion time.
The enclosing path for a @racket[define-runtime-path] is determined as
follows from the @racket[define-runtime-path] syntactic form: