diff --git a/collects/scribblings/reference/module-reflect.scrbl b/collects/scribblings/reference/module-reflect.scrbl index fc3d875c28..40bad5d696 100644 --- a/collects/scribblings/reference/module-reflect.scrbl +++ b/collects/scribblings/reference/module-reflect.scrbl @@ -51,9 +51,7 @@ the grammar for @scheme[_module-path] for @scheme[require], @defparam[current-module-name-resolver proc (case-> - (resolved-module-path? - . -> . - any) + (resolved-module-path? . -> . any) ((or/c module-path? path?) (or/c #f resolved-module-path?) (or/c #f syntax?) @@ -316,35 +314,41 @@ See also @scheme[module->language-info].} @;------------------------------------------------------------------------ @section[#:tag "dynreq"]{Dynamic Module Access} -@defproc[(dynamic-require [mod module-path?][provided (or/c symbol? #f void?)]) +@defproc[(dynamic-require [mod module-path?] + [provided (or/c symbol? #f void?)] + [fail-thunk (-> any) (lambda () ....)]) any]{ Dynamically instantiates the module specified by @scheme[mod] for @tech{phase} 0 in the current namespace's registry, if it is not yet -@tech{instantiate}d. If @scheme[mod] is not a symbol, the current -@tech{module name resolver} may load a module declaration to resolve -it (see @scheme[current-module-name-resolver]); the path is resolved -relative to @scheme[current-load-relative-directory] and/or +@tech{instantiate}d. The current @tech{module name resolver} may load +a module declaration to resolve @scheme[mod] (see +@scheme[current-module-name-resolver]); the path is resolved relative +to @scheme[current-load-relative-directory] and/or @scheme[current-directory]. If @scheme[provided] is @scheme[#f], then the result is @|void-const|, -and the module is not @tech{visit}ed (see -@secref["mod-parse"]). Otherwise, when @scheme[provided] is a symbol, -the value of the module's export with the given name is returned, and -still the module is not @tech{visit}ed. If the module exports -@scheme[provide] as syntax, then a use of the binding is expanded and -evaluated in a fresh namespace to which the module is attached, which -means that the module is @tech{visit}ed. If the module has no such -exported variable or syntax, or if the variable is protected (see -@secref["modprotect"]), the @exnraise[exn:fail:contract]. +and the module is not @tech{visit}ed (see @secref["mod-parse"]). + +When @scheme[provided] is a symbol, the value of the module's export +with the given name is returned, and still the module is not +@tech{visit}ed. If the module exports @scheme[provide] as syntax, then +a use of the binding is expanded and evaluated in a fresh namespace to +which the module is attached, which means that the module is +@tech{visit}ed. If the module has no such exported variable or syntax, +then @scheme[fail-thunk] is called; the default @scheme[fail-thunk] +raises @scheme[exn:fail:contract]. If the variable named by +@scheme[provided] is exported protected (see @secref["modprotect"]), +then the @exnraise[exn:fail:contract]. If @scheme[provided] is @|void-const|, then the module is -@tech{visit}ed but not @tech{instantiate}d (see -@secref["mod-parse"]). The result is @|void-const|.} +@tech{visit}ed but not @tech{instantiate}d (see @secref["mod-parse"]), +and the result is @|void-const|.} @defproc[(dynamic-require-for-syntax [mod module-path?] - [provided (or/c symbol? #f)]) + [provided (or/c symbol? #f)] + [fail-thunk (-> any) (lambda () ....)]) any]{ Like @scheme[dynamic-require], but in @tech{phase} 1.} diff --git a/collects/scribblings/reference/stx-trans.scrbl b/collects/scribblings/reference/stx-trans.scrbl index f05aad24f3..a7183c2278 100644 --- a/collects/scribblings/reference/stx-trans.scrbl +++ b/collects/scribblings/reference/stx-trans.scrbl @@ -396,14 +396,16 @@ exports of the module. @defproc[(syntax-local-get-shadower [id-stx identifier?]) identifier?]{ Returns @scheme[id-stx] if no binding in the current expansion context -shadows @scheme[id-stx], if @scheme[id-stx] has no module bindings in -its lexical information, and if the current expansion context is not a +shadows @scheme[id-stx] (ignoring unsealed @tech{internal-definition +contexts}), if @scheme[id-stx] has no module bindings in its lexical +information, and if the current expansion context is not a @tech{module context}. If a binding of @scheme[inner-identifier] shadows @scheme[id-stx], the -result is the same as -@scheme[(syntax-local-get-shadower inner-identifier)], except that it -has the location and properties of @scheme[id-stx]. +result is the same as @scheme[(syntax-local-get-shadower +inner-identifier)], except that it has the location and properties of +@scheme[id-stx]. When searching for a shadowing binding, bindings from +unsealed @tech{internal-definition contexts} are ignored. Otherwise, the result is the same as @scheme[id-stx] with its module bindings (if any) removed from its lexical information, and the @@ -473,7 +475,7 @@ mark}. Multiple applications of the same and different result procedures use distinct marks.} @defproc[(make-syntax-delta-introducer [ext-stx syntax?] - [base-stx syntax?] + [base-stx (or/c syntax? #f)] [phase-level (or/c #f exact-integer?) (syntax-local-phase-level)]) (syntax? . -> . syntax?)]{ @@ -482,10 +484,10 @@ Produces a procedure that behaves like @scheme[syntax-local-introduce], but using the @tech{syntax marks} of @scheme[ext-stx] that are not shared with @scheme[base-stx]. If @scheme[ext-stx] does not extend the set of marks in @scheme[base-stx] -but @scheme[ext-stx] has a module binding in the @tech{phase level} -indicated by @scheme[phase-level], then any marks of @scheme[ext-stx] -that would be needed to preserve its binding are not transferred in an -introduction. +or if @scheme[base-stx] is @scheme[#f], and if @scheme[ext-stx] has a +module binding in the @tech{phase level} indicated by +@scheme[phase-level], then any marks of @scheme[ext-stx] that would be +needed to preserve its binding are not transferred in an introduction. This procedure is potentially useful when @scheme[_m-id] has a transformer binding that records some @scheme[_orig-id], and a use of