From 969dff328ab43e3a96248fc9cce41584819b9114 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Sat, 15 Oct 2016 21:36:51 -0700 Subject: Bugfix: unable to assign to x.y.z place. This regression was caused by commit 957f80f "Bugfix: issue with expansion of place macros" on Sep 7, 2016. The commit itself is sound, but exposes a hidden problem in nearby code. * share/txr/stdlib/place.tl (sys:pl-expand): The conditions for terminating the loop and returning the expansion are too weak, due to the inclusion of an incorrect test. We must not bail when the expansion of a compound form is a compound form with the same symbol. This is because some macros behave that way, such as, oh: qref! The expansion of (qref a b c) is (qref (slot a 'b) 'c): another qref form. To fully expand, we must keep iterating until the returned form is eq to the input form. The original macroexpand (which was replaced by macroexpand-1 in 957f80f) hid this problem because macroexpand doesn't use this broken termination test. --- share/txr/stdlib/place.tl | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'share') diff --git a/share/txr/stdlib/place.tl b/share/txr/stdlib/place.tl index eb827fd4..e3ba6c0f 100644 --- a/share/txr/stdlib/place.tl +++ b/share/txr/stdlib/place.tl @@ -156,10 +156,7 @@ (sys:setq place (macroexpand-1 place env)) (when (or (eq place unex-place) (null place) - (and (atom place) (not (symbolp place))) - (and (consp place) - (consp unex-place) - (eq (car place) (car unex-place)))) + (and (atom place) (not (symbolp place)))) (return place)) (sys:setq unex-place place)))) -- cgit v1.2.3