summaryrefslogtreecommitdiffstats
path: root/tests/011/special-1.tl
Commit message (Collapse)AuthorAgeFilesLines
* bugfix: dynamic env handling in parallel bindingKaz Kylheku2016-12-231-0/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In the parallel binding (let ((x s) (s 0) (y s)) ...), both x and y must bind to the prior value of s, not to the new value 0. We have the bug that if s is a special variable, the initialization of y sees the new dynamic environment which contains the new value, so x gets the previous, y gets new. This commit fixes it. * eval.c (reparent_env): New static function. (bindings_helper): Separate logic into two loops, for sequential and parallel binding, so we don't have to repeatedly test this condition in the loop body, and can think separately about each case and streamline it. Nothing new happens under sequential binding; the behavior that is wrong for parallel binding is right for sequential. Under parallel binding, what we do is reset the dynamic environment to the original one prior to each evaluation of an initform. Then if the evaluation changes to a new dynamic environment (a special variable is being bound), we notice this and hook the new environment into a local stack, changing it parent pointer. At the end, we install this stack as the new dynamic env. Thus each init form is evaluated in the original dynamic env. * tests/011/special-1.tl: New tests added.
* Use with-out-string-stream macro in test.Kaz Kylheku2016-12-231-5/+1
| | | | | * tests/011/special-1.tl (with-output-to-string): macro removed; with-out-string-stream used.
* Convert special-1 test from txr to tl.Kaz Kylheku2016-12-231-0/+9
* tests/011/special-1.txr: Renamed to tests/011/special-1.tl and @(do ...) removed.