From aaef40301fcb91506898678c39cb62dc6fe0a285 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Wed, 9 Sep 2015 07:24:05 -0700 Subject: 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. --- share/txr/stdlib/place.tl | 9 +++++---- 1 file 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))) -- cgit v1.2.3