by catnaroek · 10y ago · 0 comments
This is particularly infuriating because the proper way to handle bound variables is already known: https://en.wikipedia.org/wiki/De_Bruijn_index .
And the state of the Clojure REPL is as mutable and imperative as it gets, as my paste showed.
No, you can't: http://pastebin.com/SdbKM7V7
In ML and Haskell, a new variable might shadow an old one (if they have the same name), but they are still different variables.
Shadowing is slightly harder to implement than rebinding, but it provides a useful guarantee for the user: the meaning of existing definitions remains stable even if new definitions are introduced into the environment.
But there's still no type-level distinction between immutable and mutable bindings, which is why included Scala in the “anything goes” category.