diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2016-05-27 06:47:50 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2016-05-27 06:47:50 -0700 |
commit | 3d9e60cb8ba2a9698336ae4697f59e14282a673d (patch) | |
tree | 29ae99b7f79935a353b6a15af89bfbbbeb402c35 /lib.h | |
parent | 6c21d7a8c99a0917818e96f50b71ecaba0a26e0c (diff) | |
download | txr-3d9e60cb8ba2a9698336ae4697f59e14282a673d.tar.gz txr-3d9e60cb8ba2a9698336ae4697f59e14282a673d.tar.bz2 txr-3d9e60cb8ba2a9698336ae4697f59e14282a673d.zip |
Fix 2011-11-17 regression.
This addresses a regression caused by commit
68ca87bc780e25dea1418019161d99727225d1ce, affecting a hundred
releases of TXR from 42 to 141.
The copy_alist call to deeply clone the variable bindings was
carelessly replaced with copy_list, to address the problem
that functions weren't able to mutate outer bindings.
However, the parameter binding code depends on the deep
cloning; it destructively manipulates bindings with the
understanding that they are copies that will be thrown away.
Test case:
@(define f0 (var))
@(end)
@(define f1 (out1 out2 var))
@ (bind out1 `a:@var`)
@ (maybe)
@ (f0 `b:@var`)
@ (end)
@ (bind out2 `a:@var`)
@(end)
@(f1 o1 o2 "z")
This program incorrectly binds o1 and o2 to different
strings, "a:z" and "a:b:z" respectively, because
the f0 pattern function call has the unwanted effect of
mutating var. Expected behavior is that both o1 and
o2 are bound to identical strings, "a:z" and "a:z".
* match.c (h_fun, v_fun): When binding arguments, extend
the environment with new bindings instead of trying to
re-use existing ones, because we do not have a copy of the
binding cells, like we used to when bindings_cp was
produced by a copy_alist call.
Diffstat (limited to 'lib.h')
0 files changed, 0 insertions, 0 deletions