Summary

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

Metadata

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.

Changes and comments

[2016-02-20 13:20:19 UTC] sjamaan changed milestone from someday to 5.1

[2016-08-25 20:18:10 UTC] sjamaan set difficulty to hard

[2018-04-29 12:06:36 UTC] sjamaan wrote:

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.

[2019-04-07 12:23:24 UTC] sjamaan changed milestone from 5.1 to 5.2

[2019-04-07 12:23:24 UTC] sjamaan wrote:

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

[2019-08-25 17:34:32 UTC] felix changed milestone from 5.2 to 5.3

[2021-04-12 13:33:56 UTC] sjamaan wrote:

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.

[2021-04-12 13:33:56 UTC] sjamaan changed milestone from 5.3 to 5.4

[2023-11-06 22:12:24 UTC] felix changed milestone from 5.4 to someday

[2023-11-06 23:51:04 UTC] felix changed milestone from someday to 6.0.0

[2023-12-21 09:35:13 UTC] sjamaan changed status from new to closed

[2023-12-21 09:35:13 UTC] sjamaan set resolution to fixed

[2023-12-21 09:35:13 UTC] sjamaan changed milestone from 6.0.0 to 5.4

[2023-12-21 09:35:13 UTC] sjamaan wrote:

Fixed with 3d035c6c