3.3.1 mischief/scope: Managing Internal Definitions
(require mischief/scope) | package: mischief-dev |
3.3.1.1 Scope Datatype
procedure
→ (or/c internal-definition-context? #false) sc : scope?
parameter
(current-scope) → scope?
(current-scope sc) → void? sc : scope?
procedure
sc : scope? = (current-scope)
procedure
(close-scope! [#:scope sc]) → scope?
sc : scope? = (current-scope)
procedure
(call-with-new-scope [#:scope? sc] proc) → any
sc : scope? = (current-scope) proc : (-> scope? any)
syntax
(with-new-scope body ...+)
3.3.1.2 Local Bindings
procedure
(scope-bind-value! id [#:scope sc]) → void?
id : identifier? sc : scope? = (current-scope)
procedure
(scope-bind-values! ids [#:scope sc]) → void?
ids : (listof identifier?) sc : scope? = (current-scope)
procedure
(scope-bind-syntax! id val [#:scope sc]) → void?
id : identifier? val : any/c sc : scope? = (current-scope)
procedure
(scope-bind-syntaxes! ids vals [#:scope sc]) → void?
ids : (listof identifier?) vals : list? sc : scope? = (current-scope)
procedure
(scope-bind-syntax/eval! id expr [#:scope sc]) → void?
id : identifier? expr : syntax? sc : scope? = (current-scope)
procedure
(scope-bind-syntaxes/eval! ids expr [ #:scope sc]) → void? ids : (listof identifier?) expr : syntax? sc : scope? = (current-scope)
procedure
(scope-static-binding? id [#:scope sc]) → boolean?
id : identifier? sc : scope? = (current-scope)
procedure
(scope-static-value id [ #:rename? rename? #:scope sc #:success success #:failure failure]) → any id : identifier? rename? : boolean? = #true sc : scope? = (current-scope) success : (-> any/c any) = identity
failure : (-> any) =
(lambda {} (wrong-syntax id "expected an identifier with a syntax binding"))
3.3.1.3 Lexical Context
procedure
stx : syntax? sc : scope? = (current-scope)
procedure
(out-of-scope stx [#:scope sc]) → syntax?
stx : syntax? sc : scope? = (current-scope)
procedure
(scope-delta-introducer id [#:scope sc]) → (-> syntax? syntax?)
id : identifier? sc : scope? = (current-scope)
3.3.1.4 Local Expansion and Evaluation
procedure
(expand-in-scope stx [ #:scope sc #:stop-at stop]) → syntax? stx : syntax? sc : scope? = (current-scope)
stop : (or/c (listof identifier?) #false) =
(if (memq (scope-expansion-context sc) '(expression module-begin)) #false '())
Note: the interpretation of '() and #false in stop are reversed from that used in the third argument to local-expand. This change is intended to make the behavior of stop more uniform: any list results in head-expansion, while #false results in recursive expansion.
procedure
(expand-expression-in-scope stx [ #:scope sc #:stop-at stop]) → syntax? stx : syntax? sc : scope? = (current-scope) stop : (or/c (listof identifier?) #false) = #false
procedure
(expand-in-scope-for-syntax stx [ #:scope sc #:stop-at stop]) → syntax? stx : syntax? sc : scope? = (current-scope) stop : (or/c (listof identifier?) #false) = #false
procedure
(eval-in-scope stx [#:scope sc]) → any
stx : syntax? sc : scope? = (current-scope)