3 ms·
"Doing just one thing and doing it well" -- which is better at this, Unix programs or Emacs functions?
by calibraxis 11y ago
"Doing just one thing and doing it well" -- which is better at this, Unix programs or Emacs functions?
- eru 11y agoAt least Unix programs don't suffer from dynamic scope. (Unless you use bash to glue them, of course.)
- rekado 11y agoThere 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.