Opened 4 years ago

Last modified 5 months ago

#1166 new defect

Globally defining an identifier previously bound to a macro should shadow the macro fully

Reported by: sjamaan Owned by: sjamaan
Priority: major Milestone: 5.1
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 (3)

comment:1 Changed 3 years ago by sjamaan

  • Milestone changed from someday to 5.1

comment:2 Changed 2 years ago by sjamaan

  • Estimated difficulty set to hard

comment:3 Changed 5 months 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.

Note: See TracTickets for help on using tickets.