summaryrefslogtreecommitdiffstats
path: root/share
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2015-11-25 20:45:50 -0800
committerKaz Kylheku <kaz@kylheku.com>2015-11-25 20:45:50 -0800
commitfc68528cf5a7714848d1f4c6ba855b763c49a85e (patch)
tree86f6e52093b071e7ea56a27dc335f1e9ffd2c9d1 /share
parent668209ba08049f1be25d8e5fec282df659c88aab (diff)
downloadtxr-fc68528cf5a7714848d1f4c6ba855b763c49a85e.tar.gz
txr-fc68528cf5a7714848d1f4c6ba855b763c49a85e.tar.bz2
txr-fc68528cf5a7714848d1f4c6ba855b763c49a85e.zip
Bugfix: sethash doesn't return stored value.
sethash mistakenly returns a boolean which indicates that the value was newly added, rather than the documented behavior of returning the new value. * hash.c (sethash): return value rather than new_p. * share/txr/stdlib/place.tl (defplace): The defplace form now seturn the main symbol of the place being defined, rather than returning whatever the last sethash call returns. (define-place-macro): Likewise. (sys:register-simple-accessor): Likewise, so that defaccessor returns the getter function's name.
Diffstat (limited to 'share')
-rw-r--r--share/txr/stdlib/place.tl18
1 files changed, 11 insertions, 7 deletions
diff --git a/share/txr/stdlib/place.tl b/share/txr/stdlib/place.tl
index 81a506a5..29c8e1fa 100644
--- a/share/txr/stdlib/place.tl
+++ b/share/txr/stdlib/place.tl
@@ -312,15 +312,18 @@
^((sethash *place-delete-expander* ',name
(lambda (,deleter-sym ,place ,body-sym)
(tree-bind ,args (cdr ,place)
- ,delete-body)))))))))
+ ,delete-body)))))
+ ',name))))
(defmacro define-place-macro (name place-destructuring-args . body)
(with-gensyms (name-dummy args)
- ^(sethash *place-macro* ',name
- (lambda (,args)
- (mac-param-bind ,args
- (,name-dummy ,*place-destructuring-args)
- ,args ,*body)))))
+ ^(progn
+ (sethash *place-macro* ',name
+ (lambda (,args)
+ (mac-param-bind ,args
+ (,name-dummy ,*place-destructuring-args)
+ ,args ,*body)))
+ ',name)))
(defplace (sys:var arg) body
(getter setter
@@ -666,7 +669,8 @@
(lambda (ssetter place body)
^(macrolet ((,ssetter (val)
^(,',set-fun ,*(cdr ',place) ,val)))
- ,body))))
+ ,body)))
+ get-fun)
(defmacro define-accessor (get-fun set-fun)
^(sys:register-simple-accessor ',get-fun ',set-fun))