4 ms·
There are some instances where dynamic scope actually is not as insane as it may seem. Although the paper is probably dated and opinions have changed since the
by rekado 11y ago
There are some instances where dynamic scope actually is not as insane as it may seem. Although the paper is probably dated and opinions have changed since then I can still understand that there are practical reasons to dynamic scope in some instances:
https://www.gnu.org/software/emacs/emacs-paper.html#SEC18 https://www.gnu.org/software/emacs/emacs-paper.html#SEC18
All my own Elisp code uses lexical scoping by default and I don't trust myself enough to use dynamic parameters liberally in my code. But I don't think it's entirely unreasonable to have the ability to dynamically override internals.
- eru 11y agoOh, definitely. Even extremely statically minded Haskell offers a dynamic scoping construct: the reader monad. (As Haskell is wont to do, this monad infects every user of it with a `tag', just like IO does. No silent surprises from dynamic scoping here.)
- mbrock 11y agoImplicit parameters, too.