So given that - how do we fix it? Introduce a new way to refer to "globals", some kind of "binding" object?
The simplest way is probably to introduce a pseudo-operator like for example, "&" to refer to the binding object. For example:
&Foo isUndeclared "answers true if binding is undeclared" &Foo ifUndeclared:[...] "eval if binding is undeclared" &Foo ifAbsent:[...]. "eval if binding's value isn't present"
etc. with &Foo being a simple compiler hack which instead of emitting pushLiteralVariable bytecode (e.g., pushing the value of the binding) merely emits pushLiteralConstant (e.g., pushing the binding itself).
(note that in order to do this it would be extremely worthwhile to get away from using Associations and instead make some specific VariableBinding objects which implement the above methods)
Cheers, - Andreas