Was sind die Vorteile von Dynamic Scoping?
Ich habe gelernt, dassstatic scoping ist der einzig vernünftige Weg, Dinge zu tun, und dasdynamic scoping ist das Werkzeug des Teufels und resultiert nur aus schlechten Implementierungen von Interpreten / Compilern.
Dann sah ich diesen Ausschnitt aus einemCommon Lisp vs. Scheme article:
Both Lexically and Dynamically Lexical scope only, per the standard. scoped special vars. Common Dynamically scoped vars are provided Lisp just wins on this point. by some implementations as an extension but code using them is not portable. (I have heard the arguments about whether Dynamic scoping is or is not a Bad Idea in the first place. I don't care. I'm just noting that you can do things with it that you can't easily do without it.)
Warum gewinnt Common Lisp in diesem Punkt? Welche Dinge sind mit dynamischem Scoping einfacher zu tun? Ich kann es wirklich nicht rechtfertigen, es jemals zu brauchen / als eine gute Sache zu sehen.