Next: expander lexenv prim names, Up: expander lexenv prim [Index]
We must remember that a syntactic binding’s descriptor is a pair with format:
(?binding-type . ?binding-value)
first let’s create an environment
object with the system
library:
(define env (environment '(psyntax system $all)))
then let’s look at some descriptors:
display
:
(define-values (label descriptor) (environment-binding 'display env)) descriptor ⇒ (core-prim . display) (symbol-value label) ⇒ (core-prim . display) (eq? descriptor (symbol-value label)) ⇒ #t
in the descriptor: ?binding-type is the symbol ‘core-prim’ and ?binding-value is the symbol ‘display’, which is the public name of the primitive function.
lambda
:
(define-values (label descriptor) (environment-binding 'lambda env)) descriptor ⇒ (core-macro . lambda) (symbol-value label) ⇒ (core-macro . lambda) (eq? descriptor (symbol-value label)) ⇒ #t
in the descriptor: ?binding-type is the symbol ‘core-macro’ and ?binding-value is the symbol ‘lambda’, which is the public name of the primitive syntax.
let
:
(define-values (label descriptor) (environment-binding 'let env)) descriptor ⇒ (macro . let) (symbol-value label) ⇒ (macro . let) (eq? descriptor (symbol-value label)) ⇒ #t
in the descriptor: ?binding-type is the symbol ‘macro’ and ?binding-value is the symbol ‘let’, which is the public name of the primitive syntax.
&condition
, which is implemented as
R6RS record type:
(define-values (label descriptor) (environment-binding '&condition env)) descriptor ⇒ (core-object-type-name . (#<record-type-spec> . (&condition &condition-rtd &condition-rcd <condition> make-simple-condition condition? ()))) (symbol-value label) ⇒ (core-object-type-name . (#<record-type-spec> . (&condition &condition-rtd &condition-rcd <condition> make-simple-condition condition? ()))) (eq? descriptor (symbol-value label)) ⇒ #t
in the descriptor: ?binding-type is the symbol ‘core-object-type-name’ and ?binding-value is the list:
(#<record-type-spec> . (&condition &condition-rtd &condition-rcd <condition> make-simple-condition condition? ()))
we can further inspect &condition-rtd
and &condition-rcd
:
(receive (label descriptor) (environment-binding '&condition-rtd env) descriptor) ⇒ ($core-rtd . &condition-rtd) (receive (label descriptor) (environment-binding '&condition-rcd env) descriptor) ⇒ ($core-rcd . &condition-rcd)
Next: expander lexenv prim names, Up: expander lexenv prim [Index]