Opened 9 years ago

Closed 3 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 8 years ago by sjamaan

Milestone: someday5.1

comment:2 Changed 8 years ago by sjamaan

Estimated difficulty: hard

comment:3 Changed 6 years ago by sjamaan

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 in core.scm and eval.scm), so ##sys#alias-global-hook isn't to blame for this particular behaviour.

comment:4 Changed 5 years ago by sjamaan

Milestone: 5.15.2

Getting ready for 5.1, moving tickets which won't make it in to 5.2.

comment:5 Changed 5 years ago by felix winkelmann

Milestone: 5.25.3

comment:6 Changed 3 years ago by sjamaan

Milestone: 5.35.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 4 months ago by felix winkelmann

Milestone: 5.4someday

comment:8 Changed 4 months ago by felix winkelmann

Milestone: someday6.0.0

comment:9 Changed 3 months ago by sjamaan

Milestone: 6.0.05.4
Resolution: fixed
Status: newclosed

Fixed with 3d035c6c

Note: See TracTickets for help on using tickets.