Opened 11 years ago
Closed 2 years ago
#1166 closed defect (fixed)
Globally defining an identifier previously bound to a macro should shadow the macro fully
| Reported by: | sjamaan | Owned by: | sjamaan |
|---|---|---|---|
| Priority: | major | Milestone: | 5.4 |
| Component: | expander | Version: | |
| Keywords: | Cc: | ||
| Estimated difficulty: | hard |
Description
Pointed out by Michele La Monaca: CHICKEN behaves a little too inconsistent wrt scoping:
(define begin -) (begin 0 1) => 1 ;; expected: -1
It would make more sense if the macro was erased from the environment.
It's probably doable, but in order to make this work the way environments are handled need to be completely overhauled.
Change History (9)
comment:1 by , 10 years ago
| Milestone: | someday → 5.1 |
|---|
comment:2 by , 9 years ago
| Estimated difficulty: | → hard |
|---|
comment:3 by , 8 years ago
comment:4 by , 7 years ago
| Milestone: | 5.1 → 5.2 |
|---|
Getting ready for 5.1, moving tickets which won't make it in to 5.2.
comment:5 by , 6 years ago
| Milestone: | 5.2 → 5.3 |
|---|
comment:6 by , 5 years ago
| Milestone: | 5.3 → 5.4 |
|---|
Looks like this already works in the compiler(!), but not the interpreter. In 5.0.0 it works already.
Presumably the difference is due to the mismatch between variable lookups discussed in #1131 (but it might be a subtly different one)
Looks like we're getting closer to fixing all such annoying irregularities.
comment:7 by , 2 years ago
| Milestone: | 5.4 → someday |
|---|
comment:8 by , 2 years ago
| Milestone: | someday → 6.0.0 |
|---|
comment:9 by , 2 years ago
| Milestone: | 6.0.0 → 5.4 |
|---|---|
| Resolution: | → fixed |
| Status: | new → closed |
Fixed with 3d035c6c

See also the dreaded #1131; I think this is related to how
##sys#alias-global-hookperforms its lookup: it will look up in the environment first, and if not found, it will module-rename the symbol if necessary, and finally it will just return the symbol as-is, and its bound-at-toplevel value will used in that case. This means any imported bindings always take precedence.Note that before we enter
##sys#alias-global-hook, we'll do a lookup in##sys#current-environmentfirst (in the code walkers incore.scmandeval.scm), so##sys#alias-global-hookisn't to blame for this particular behaviour.