diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2015-12-10 22:48:34 -0800 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2015-12-10 22:48:34 -0800 |
commit | c58a1a16de19700543700b24dd42dd3c234493b7 (patch) | |
tree | 931d74c98ebb9c5f76ab93ea1df67863700ee85a /share | |
parent | 8220c2ea55a59bee7bfdef3b5c9b180005ef95ee (diff) | |
download | txr-c58a1a16de19700543700b24dd42dd3c234493b7.tar.gz txr-c58a1a16de19700543700b24dd42dd3c234493b7.tar.bz2 txr-c58a1a16de19700543700b24dd42dd3c234493b7.zip |
symbol-function semantics change; new symbol-macro.
* eval.c (symbol_function): Only retrieve function binding,
and not macro or operator bindings, unless compatibility
<= 127 is in effect.
(symbol_macro): New function.
(fboundp): Only test for existence of function, not
macro or operator, unless <= 127 compatibility is in effect.
(fmakunbound): Do not remove macro binding, unless
compatibility <= 127 is in effect.
(eval_init): Register sys:top-mb variable for use in place.tl
library module. Register symbol-macro intrinsic function.
* share/txr/stdlib/place.tl (sys:get-mb): New function
(symbol-macro): New syntactic place.
* txr.1: Updated incorrect documentation about environments
from the perspective that macros and functions coexist.
Documented symbol-macro. Updated symbol-function, fboundp
and fmakunbound documentation. Added missing documentation
for mmakunbound. Reference to fboundp under define-place-macro
revised to mboundp. Added compatibility notes.
Diffstat (limited to 'share')
-rw-r--r-- | share/txr/stdlib/place.tl | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/share/txr/stdlib/place.tl b/share/txr/stdlib/place.tl index 29c8e1fa..02a5c653 100644 --- a/share/txr/stdlib/place.tl +++ b/share/txr/stdlib/place.tl @@ -584,6 +584,22 @@ ^(macrolet ((,deleter () ^(fmakunbound ,',sym-expr))) ,body))) +(defun sys:get-mb (sym) + (or (gethash sys:top-mb sym) + (sys:eval-err "unbound macro ~s" sym))) + +(defplace (symbol-macro sym-expr) body + (getter setter + (with-gensyms (binding-sym) + ^(let ((,binding-sym (sys:get-mb ,sym-expr))) + (macrolet ((,getter () ^(cdr ,',binding-sym)) + (,setter (val) ^(sys:rplacd ,',binding-sym ,val))) + ,body)))) + : + (deleter + ^(macrolet ((,deleter () ^(mmakunbound ,',sym-expr))) + ,body))) + (defun sys:get-vb (sym) (or (gethash sys:top-vb sym) (sys:eval-err "unbound variable ~s" sym))) |