use namespace-variable-value for !defined, and add !syntax
svn: r12433
This commit is contained in:
parent
4f904c3b4b
commit
f4f559fc3b
|
@ -654,9 +654,26 @@
|
|||
(define-syntax-rule (!defined id ...)
|
||||
;; expected to be used only with identifiers
|
||||
(begin (with-handlers ([exn:fail:contract:variable?
|
||||
(lambda (_)
|
||||
(error* "missing binding: ~e" (->disp 'id)))]
|
||||
[exn:fail:syntax?
|
||||
(lambda (_)
|
||||
(error* "bound to a syntax, expecting a value: ~e"
|
||||
(->disp 'id)))])
|
||||
(namespace-variable-value `id #t #f
|
||||
(get-namespace (submission-eval))))
|
||||
...))
|
||||
|
||||
(provide !syntax)
|
||||
(define-syntax-rule (!syntax id ...)
|
||||
;; expected to be used only with identifiers
|
||||
(begin (with-handlers ([exn:fail:syntax? void]
|
||||
[exn:fail:contract:variable?
|
||||
(lambda (_)
|
||||
(error* "missing binding: ~e" (->disp 'id)))])
|
||||
((submission-eval) `id))
|
||||
(namespace-variable-value `id #t #f
|
||||
(get-namespace (submission-eval)))
|
||||
(error* "bound to a value, expecting a syntax: ~e" (->disp 'id)))
|
||||
...))
|
||||
|
||||
(provide !procedure* !procedure)
|
||||
|
|
|
@ -333,6 +333,10 @@ code.}
|
|||
|
||||
Checks that @scheme[id] is defined, and is bound to a procedure.}
|
||||
|
||||
@defform[(!syntax id arity)]{
|
||||
|
||||
Checks that @scheme[id] is defined, and is bound as a macro.}
|
||||
|
||||
@defform[(!procedure* expr arity)]{
|
||||
|
||||
Similar to @scheme[!procedure] but omits the defined check, making
|
||||
|
|
Loading…
Reference in New Issue
Block a user