summaryrefslogtreecommitdiffstats
path: root/stdlib/optimize.tl
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2022-09-15 07:22:50 -0700
committerKaz Kylheku <kaz@kylheku.com>2022-09-15 07:22:50 -0700
commit4c2149bf3ceecdd1cd6e2697cdc0e2fb88a6a6b8 (patch)
tree72a56716c0e037f25fc0c72b610de5e50ae53ff7 /stdlib/optimize.tl
parentf25d07b2f74150a5402fc34201beb34e2f5e99e0 (diff)
downloadtxr-4c2149bf3ceecdd1cd6e2697cdc0e2fb88a6a6b8.tar.gz
txr-4c2149bf3ceecdd1cd6e2697cdc0e2fb88a6a6b8.tar.bz2
txr-4c2149bf3ceecdd1cd6e2697cdc0e2fb88a6a6b8.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 'stdlib/optimize.tl')
0 files changed, 0 insertions, 0 deletions