Dynamic scoping works badly with laziness. The binding might change between evaluations of two chunks, so the value might appear inconsistent.
When using laziness, avoid dynamic scoping or capture variables explicitly.
Is there a way for lazy function to capture the current value of the variable into a closure?
- It does seem to be possible if language implementation accounts for that