Opened 10 years ago
Closed 15 months 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 Changed 9 years ago by
Milestone: | someday → 5.1 |
---|
comment:2 Changed 9 years ago by
Estimated difficulty: | → hard |
---|
comment:3 Changed 7 years ago by
comment:4 Changed 6 years ago by
Milestone: | 5.1 → 5.2 |
---|
Getting ready for 5.1, moving tickets which won't make it in to 5.2.
comment:5 Changed 6 years ago by
Milestone: | 5.2 → 5.3 |
---|
comment:6 Changed 4 years ago by
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 Changed 16 months ago by
Milestone: | 5.4 → someday |
---|
comment:8 Changed 16 months ago by
Milestone: | someday → 6.0.0 |
---|
comment:9 Changed 15 months ago by
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-hook
performs 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-environment
first (in the code walkers incore.scm
andeval.scm
), so##sys#alias-global-hook
isn't to blame for this particular behaviour.