3 ms·
I'm reminded of Clojure's ability to rebind global functions with dynamic scope on a thread local basis, and Ruby's ability to monkey-patch.
by JulianMorrison 15y ago
I'm reminded of Clojure's ability to rebind global functions with dynamic scope on a thread local basis, and Ruby's ability to monkey-patch.
- danssig 15y agoThe SBCL common lisp implementation (at least, I'm sure it's not the only one) can also do thread local dynamic binding.
- JulianMorrison 15y agoWhat would be interesting would be if some language offered the ability to do thread-local (or thread-heritable) dynamically scoped monkey patching, and closures over monkey patches. So you could make a function that rebinds the implementation of lists, and can return a list that is for example backed by a mmapped file.
- JulianMorrison 15y agoAlso: what makes Clojure's dynamic binding stand out is you can rebind pretty much anything, not just special variables - if it's implemented as a "var", you can rebind it. That goes for both data and functions.