[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Chicken-hackers] [PATCH] Fix hygiene in ##sys#expand-extended-lambda-li
From: |
Peter Bex |
Subject: |
[Chicken-hackers] [PATCH] Fix hygiene in ##sys#expand-extended-lambda-list |
Date: |
Fri, 17 Jun 2016 17:54:24 +0200 |
User-agent: |
Mutt/1.5.23 (2014-03-12) |
Hi all,
While updating the import list for the "object-evict" CHICKEN 5 egg,
I noticed that it would error out if I left out the "chicken" import.
The reason was that it needed these identifiers:
- when
- unless
- void
- optional
The first 3 I understand, we'll need to take them from (chicken base)
once we create it, but the final entry in the list was a bit surprising.
It turns out that I rediscovered an old bug found by Moritz (#806):
If you use #!optional or #!rest in a lambda list, CHICKEN will expand
that to a few macro calls, including the "optional" macro, using the
syntactic environment of the module in which the expanded lambda occurs.
This is the wrong environment, because the user may not even have
imported the chicken module. Worse, if the user defined their own
version of "optional", that will be used instead of the correct one.
This is rarely a problem, because everyone always imports the chicken
and scheme modules anyway, but it shouldn't be *required* to do that.
It's unhygienic.
Thus, attached is a fix that takes the optional, let-optionals* and let*
macros from the correct environments instead of using the syntactic
environment of the current module, which isn't under our control.
I also noticed that let-optionals* used quote, car and cdr but didn't
grab these definitions from the default environment so they would be
undefined unless the current environment happened to include them.
This patch applies to both master and chicken-5, and I *think* it
completely fixes #806, but you never know for sure ;)
Cheers,
Peter
0001-Fix-several-hygiene-issues-in-DSSSL-expansions-806.patch
Description: Text Data
signature.asc
Description: Digital signature
- [Chicken-hackers] [PATCH] Fix hygiene in ##sys#expand-extended-lambda-list,
Peter Bex <=