diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2021-04-05 07:34:45 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2021-04-05 07:34:45 -0700 |
commit | 28addfad27fc5c4ca7592789cc587a0faada9a42 (patch) | |
tree | b1b6c03d7bf452e273d7ec181d1518116c199ddd | |
parent | cd0ff844f0edf0f9dbee49bf84e6c497a02d8e33 (diff) | |
download | txr-28addfad27fc5c4ca7592789cc587a0faada9a42.tar.gz txr-28addfad27fc5c4ca7592789cc587a0faada9a42.tar.bz2 txr-28addfad27fc5c4ca7592789cc587a0faada9a42.zip |
struct: fix lack of hygiene in null-safe qref.
The expression a.?b is not being treated hygienically;
a is evaluated twice. This is only if the null-safe object
is the left most; a.b.?c is hygienic.
* share/txr/stdlib/struct.tl (qref): Add the necessary gensym
use to fix the broken case.
-rw-r--r-- | share/txr/stdlib/struct.tl | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/share/txr/stdlib/struct.tl b/share/txr/stdlib/struct.tl index 2eecfbc7..ca3de714 100644 --- a/share/txr/stdlib/struct.tl +++ b/share/txr/stdlib/struct.tl @@ -211,7 +211,9 @@ (throwf 'eval-error "~s: bad syntax" 'qref)) (tree-case obj ((a b) (if (eq a 't) - ^(if ,b (qref ,b ,*refs)) + (let ((s (gensym))) + ^(slet ((,s ,b)) + (if ,s (qref ,s ,*refs)))) :)) (x (tree-case refs (() ()) |