Consider subtle scoping/shadowing rules #65
Labels
No Label
accepted
bug
clj
documentation
enhancement
errors
infrastructure
later
next
now
optimization
proposal
question
research
semantics
syntax
ux
vm
wontfix
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: twc/ludus#65
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Consider the following code:
This is because, once the name
add
is shadowed, it clobbers the prelude functionadd
, and expects only one argument. So whenmyadd
is called, theadd
in its body resolves to the local functionadd
, not the prelude function add.It's bad practice to shadow prelude functions, but it is possible.
The reason for late-bound local context is, I suppose, for mutual recursion. But since we now require forward declarations, perhaps we freeze the context when we make the function.
Just did it: copied the context the function closes over into a struct, never worry about this again.
Had to do some fancy footwork with forward declarations, but it the solution works!
a25ece5a68