Could Emacs be rewritten in Python?
tanzer at swing.co.at
Fri Apr 11 18:52:51 CEST 2003
"Anders J. Munch" <andersjm at dancontrol.dk> wrote:
> "Christian Tanzer" <tanzer at swing.co.at> wrote:
> > Carl Banks <imbosol-1049990205 at aerojockey.com> wrote:
> > > I think dynamic scpoing is a wholly bad idea, and simplifying a very
> > > misguided programming practice doesn't make it any less so.
> > You are of course right. Surprisingly though, it works very well for
> > Emacs. Passing arguments would *not* work in the context of Emacs.
> What makes you say that?
The part you didn't quote <wink>. Here it is:
=> What you're missing is that Globals are Evil(tm), and furthermore,
=> that if your program depends on changing a global in a dynamic scope,
=> it badly needs to be redesigned. (To wit, that functions that refer
=> to the global you want to change need to be changed to accept it as an
`You are of course right` referred only to this paragraph.
The `Passing arguments would *not* work in the context of Emacs`
referred ony to the `To wit, ...` snippet.
> Why wouldn't lexical scoping supplemented by
> a temporary-global-binding construct work just as well or better?
Dynmaic scoping is used for lots of things in Emacs. With a different
design many of those uses could certainly be replaced by a simpler
design. I doubt that one could easily replace all of them, though.
As someone else pointed out, dynamic scoping is used to change values
of functions called indirectly -- thus converting them into arguments
passed around doesn't really work. One could use a
temporary-global-binding approach (or better temporary-object-binding
[as in temporarily overriding a buffer attribute]), but without special
forms like `with-` style macros it would look rather clumsily.
Christian Tanzer tanzer at swing.co.at
Glasauergasse 32 Tel: +43 1 876 62 36
A-1130 Vienna, Austria Fax: +43 1 877 66 92
More information about the Python-list