docs on variable-reference->...namespace

svn: r7767
This commit is contained in:
Matthew Flatt 2007-11-19 19:01:26 +00:00
parent 12504d82f5
commit e8097b4eaf
2 changed files with 44 additions and 6 deletions

View File

@ -61,10 +61,11 @@ source of the anchor.
If the anchor is from a @scheme[define-namespace-anchor] form in a
module context, then the source is the namespace in which the
containing module is instantiated at @tech{phase} 0. If the anchor is
from a @scheme[define-namespace-anchor] form in a top-level content,
then the source is the namespace in which the anchor definition was
evaluated.}
containing module is instantiated. If the anchor is from a
@scheme[define-namespace-anchor] form in a top-level content, then the
source is the namespace in which the anchor definition was evaluated.
The resulting namespace corresponds to @tech{phase} 0, independent of
the phase of @scheme[a]'s definition.}
@defproc[(namespace-anchor->namespace [a namespace-anchor?]) namespace?]{
@ -287,3 +288,34 @@ indices.
Typically, the arguments to @scheme[module-provide-protected?]
correspond to the first two elements of a list produced by
@scheme[identifier-binding].}
@defproc[(variable-reference->empty-namespace [varref variable-reference?])
namespace?]{
Returns an empty namespace that shares module declarations and
instances with the namespace in which @scheme[varref] is
instantiated. The namespace corresponds to @tech{phase} 0, independent
of the phase of @scheme[varref]'s binding.}
@defproc[(variable-reference->top-level-namespace [varref variable-reference?])
namespace?]{
If @scheme[varref] refers to a top-level binding, the result is
@scheme[varref]'s namespace if it corresponds to a @tech{phase} 0
binding, otherwise it is the @tech{phase} 0 namespace associated with
@scheme[varref]'s namespace.
If @scheme[varref] refers to a module binding, then the
@exnraise[exn:fail:contract].}
@defproc[(variable-reference->resolved-module-path [varref variable-reference?])
resolved-module-path?]{
If @scheme[varref] refers to a module binding, the result is a
@tech{resolved module path} naming the module.
If @scheme[varref] refers to a top-level binding, then the
@exnraise[exn:fail:contract].}

View File

@ -141,8 +141,14 @@ Produces an opaque value representing the location of @scheme[id],
which must be bound as a @tech{top-level variable} or
@tech{module-level variable}.
The result is useful only to low-level extensions; see
@secref["inside-mzscheme"].}
The result is useful to low-level extensions; see
@secref["inside-mzscheme"]. It can also be used with
@scheme[variable-reference->empty-namespace],
@scheme[variable-reference->resolved-module-path], and
@scheme[variable-reference->top-level-namespace], but facilities
like @scheme[define-namespace-anchor] and
@scheme[namespace-anchor->namespace] wrap those to provide an clearer
interface.}
@;------------------------------------------------------------------------
@section[#:tag "application"]{Procedure Applications and @scheme[#%app]}