diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2022-09-15 07:22:50 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2022-09-15 07:22:50 -0700 |
commit | 5c73a495f9563bcccba5a5989f2ae9b50d7280bb (patch) | |
tree | 72a56716c0e037f25fc0c72b610de5e50ae53ff7 /buf.c | |
parent | 8ca41d8efe17a932e0fe13782021f7430f188568 (diff) | |
download | txr-5c73a495f9563bcccba5a5989f2ae9b50d7280bb.tar.gz txr-5c73a495f9563bcccba5a5989f2ae9b50d7280bb.tar.bz2 txr-5c73a495f9563bcccba5a5989f2ae9b50d7280bb.zip |
compiler: bug: scoping of lambda optionals.
The scoping is not behind handled correctly for optional
variables. The init-forms are being evaluated in a scope
in which all the variables are already visible, instead
of sequentially. Thus, for instance, variable rebinding
doesn't work, as in (lambda (: (x x)) ...). When the
argument is missing, x ends up with the value : because
the expression refers to the new x, rather than the
outer x.
* stdlib/compiler.tl (compiler comp-lambda-impl):
Perform the compilation of the init-forms earlier.
Use the same new trick that is used for let*:
the target for the code fragment is a locaton obtained
from get-loc, which is then attached to a variable
afterward. The spec-sub helper is extended with a loc
parameter to help with this case.
* tests/012/lambda.tl: New test case that fails without
this fix.
Diffstat (limited to 'buf.c')
0 files changed, 0 insertions, 0 deletions