diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2015-09-09 07:24:05 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2015-09-09 07:24:05 -0700 |
commit | aaef40301fcb91506898678c39cb62dc6fe0a285 (patch) | |
tree | 4b0f4c4f6109b135b761426870a0223534f29491 /share | |
parent | e6319aa9e43aa5daa8232bcfada83fd0affa0bfc (diff) | |
download | txr-aaef40301fcb91506898678c39cb62dc6fe0a285.tar.gz txr-aaef40301fcb91506898678c39cb62dc6fe0a285.tar.bz2 txr-aaef40301fcb91506898678c39cb62dc6fe0a285.zip |
Bugfix: multiple evaluation problem in slot place.
* share/txr/stdlib/place.tl (defplace slot): The slot
argument must be evaluated only once, a gensym is
established for it, just like for the object form.
Diffstat (limited to 'share')
-rw-r--r-- | share/txr/stdlib/place.tl | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/share/txr/stdlib/place.tl b/share/txr/stdlib/place.tl index 8b1b4379..14cb87b6 100644 --- a/share/txr/stdlib/place.tl +++ b/share/txr/stdlib/place.tl @@ -594,10 +594,11 @@ (defplace (slot struct sym) body (getter setter - (with-gensyms (struct-sym) - ^(rlet ((,struct-sym ,struct)) - (macrolet ((,getter () ^(slot ,',struct-sym ,',sym)) - (,setter (val) ^(slotset ,',struct-sym ,',sym ,val))) + (with-gensyms (struct-sym slot-sym) + ^(rlet ((,struct-sym ,struct) + (,slot-sym ,sym)) + (macrolet ((,getter () ^(slot ,',struct-sym ,',slot-sym)) + (,setter (val) ^(slotset ,',struct-sym ,',slot-sym ,val))) ,body)))) (ssetter ^(macrolet ((,ssetter (val) ^(slotset ,',struct ,',sym ,val))) |