docs: correct and improve docs for instance-set-variable-value!

Closes #2139
This commit is contained in:
Matthew Flatt 2018-06-19 15:53:48 -06:00
parent d72ccb521d
commit 931db97fc0

View File

@ -106,7 +106,7 @@ uninitialized variables provides core support for top-level evaluation
where variables may be referenced and then defined in a separate where variables may be referenced and then defined in a separate
element of compilation. element of compilation.
@history[#:added "6.6.1"] @history[#:added "6.90.0.1"]
@; -------------------------------------------------- @; --------------------------------------------------
@ -385,17 +385,28 @@ Sets or creates the variable exported as @racket[name] in
variable does not exist already as constant. If a variable for variable does not exist already as constant. If a variable for
@racket[name] exists as constant, the @exnraise[exn:fail:contract]. @racket[name] exists as constant, the @exnraise[exn:fail:contract].
If @racket[mode] is a single, then the variable is created or changed If @racket[mode] is @racket['constant] or @racket['consistent], then
to be constant. If @racket[mode] is @racket['consistent], then the variable is created or changed to be constant. Furthermore, when
the optimizer can assume that the value has the same shape in all the instance is reported for a linklet's import though a
instances that are used to satisfy a linklet's imports.} @racket[_get-import] callback to @racket[compile-linklet], the
compiler can assume that the variable will be constant in all future
instances that are used to satisfy a linklet's imports.
If @racket[mode] is @racket['consistent], when the instance is
reported though a callback to @racket[compile-linklet], the compiler
can further assume that the variable's value will be the same for
future instances. For compilation purposes, ``the same'' can mean that
a procedure value will have the same arity and implementation details,
a @tech{structure type} value will have the same configuration, a
marshalable constant will be @racket[equal?] to the current value, and
so on.}
@defproc[(instance-unset-variable! [instance instance?] @defproc[(instance-unset-variable! [instance instance?]
[name symbol?]) [name symbol?])
void?]{ void?]{
Changes @racket[instance] so taht it does not export a variable as Changes @racket[instance] so that it does not export a variable as
@racket[name], as long as @racket[name] does not exist as a constant @racket[name], as long as @racket[name] does not exist as a constant
variable. If a variable for @racket[name] exists as constant, the variable. If a variable for @racket[name] exists as constant, the
@exnraise[exn:fail:contract].} @exnraise[exn:fail:contract].}