Dictu
Dictu copied to clipboard
Fix a niche issue with global shadowing
Well detailed description of the change :
This change makes it so that shadowing a builtin in the module level space has the same effect as shadowing a builtin in the local level space. Previously setting a variable with an identifier of a builtin (e.g input) in the module level space would keep the value of the builtin value rather than taking the new value of the variable. Shadowing should be avoided, but this at least keeps the scoping consistent.
Resolves: #341
Type of change:
- [x] Bug fix
Housekeeping
-
[x] Tests have been updated to reflect the changes done within this PR (if applicable).
-
[x] Documentation has been updated to reflect the changes done within this PR (if applicable).
This will need revising, tested via the REPL and works, however, executing a file it will not work. This is due to the fact that the variable would not have been added to the VM module until runtime and we are checking at compile time. Works in the REPL as each line is a new compilation
Hi (again), I have a similar issue also in my little language. The problem isn't really in the search of the variable, but more of how var declaration works, since it always leads to a module definition (or local), so it creates the variable at module scope, but it will always be shadowed by the global definition. Or at least, that's what I was thinking.