small doc improvements on internal definitions

This commit is contained in:
Matthew Flatt 2010-11-07 10:06:54 -07:00
parent bc4f4e7a45
commit 3b470fe47b
2 changed files with 13 additions and 2 deletions

View File

@ -604,7 +604,8 @@ then expansion stops without adding the identifier.
@subsection[#:tag "intdef-body"]{Internal Definitions} @subsection[#:tag "intdef-body"]{Internal Definitions}
An @tech{internal-definition context} corresponds to a partial expansion step An @tech{internal-definition context} corresponds to a partial expansion step
(see @secref["partial-expansion"]). A form that supports internal (see @secref["partial-expansion"]). Forms that allow internal definitions document
such positions using the @racket[_body] meta-variable. A form that supports internal
definitions starts by expanding its first form in an definitions starts by expanding its first form in an
internal-definition context, but only partially. That is, it internal-definition context, but only partially. That is, it
recursively expands only until the form becomes one of the following: recursively expands only until the form becomes one of the following:

View File

@ -655,7 +655,7 @@ an identifier can be either imported or defined for a given
@defform[(local-require require-spec ...)]{ @defform[(local-require require-spec ...)]{
Like @scheme[require], but for use in a local-definition context to Like @scheme[require], but for use in a @tech{internal-definition context} to
import just into the local context. Only bindings from @tech{phase import just into the local context. Only bindings from @tech{phase
level} 0 are imported.} level} 0 are imported.}
@ -1928,6 +1928,8 @@ defined as follows:
@#,elem{if} (#,cvt head . _datum) = expr @#,elem{if} (#,cvt head . _datum) = expr
] ]
In an @tech{internal-definition context} (see @secref["intdef-body"]),
a @racket[define] form introduces a local binding.
At the top level, the top-level binding @racket[id] is created after At the top level, the top-level binding @racket[id] is created after
evaluating @racket[expr], if it does not exist already, and the evaluating @racket[expr], if it does not exist already, and the
top-level mapping of @racket[id] (in the @techlink{namespace} linked top-level mapping of @racket[id] (in the @techlink{namespace} linked
@ -1958,6 +1960,8 @@ Evaluates the @racket[expr], and @tech{bind}s the results to the
@racket[id]s; if @racket[expr] produces a different number of results, @racket[id]s; if @racket[expr] produces a different number of results,
the @exnraise[exn:fail:contract]. the @exnraise[exn:fail:contract].
In an @tech{internal-definition context} (see @secref["intdef-body"]),
a @racket[define-values] form introduces local bindings.
At the top level, the top-level binding for each @racket[id] is At the top level, the top-level binding for each @racket[id] is
created after evaluating @racket[expr], if it does not exist already, created after evaluating @racket[expr], if it does not exist already,
and the top-level mapping of each @racket[id] (in the and the top-level mapping of each @racket[id] (in the
@ -1987,6 +1991,9 @@ The second form is a shorthand the same as for @racket[define]; it
expands to a definition of the first form where the @racket[expr] is a expands to a definition of the first form where the @racket[expr] is a
@racket[lambda] form.} @racket[lambda] form.}
In an @tech{internal-definition context} (see @secref["intdef-body"]),
a @racket[define-syntax] form introduces a local binding.
@defexamples[#:eval (syntax-eval) @defexamples[#:eval (syntax-eval)
(define-syntax foo (define-syntax foo
(syntax-rules () (syntax-rules ()
@ -2015,6 +2022,9 @@ When @racket[expr] produces zero values for a top-level
position), then the @racket[id]s are effectively declared without position), then the @racket[id]s are effectively declared without
binding; see @secref["macro-introduced-bindings"]. binding; see @secref["macro-introduced-bindings"].
In an @tech{internal-definition context} (see @secref["intdef-body"]),
a @racket[define-syntaxes] form introduces local bindings.
@defexamples[#:eval (syntax-eval) @defexamples[#:eval (syntax-eval)
(define-syntaxes (foo1 foo2 foo3) (define-syntaxes (foo1 foo2 foo3)
(let ([transformer1 (lambda (syntax-object) (let ([transformer1 (lambda (syntax-object)