Could Emacs be rewritten in Python?

François Pinard pinard at iro.umontreal.ca
Fri Apr 11 19:00:08 EDT 2003


[Beni Cherniavsky]

> To clarify the issue completely, the emacs lisp manual contains a
> must-read section:

> http://www.gnu.org/manual/elisp-manual-21-2.8/html_node/elisp_147.html#SEC147

> [...] It also describes some implementation details - not that I believe
> we want dynamic scope... [...]

Oh, I would not say that the above text is clarifying the issue completely.
It rather gives a flying glimpse over the problem, within the context of a
discussion about a project considering a rewrite of Emacs in Python.

For example, the shallow binding implementation is not really acceptable for
buffer local variables, even if most non buffer local variables use it.  Not
to speak about the complexity associated with various defaulting or
initialising mechanism for variables in buffers.

Bindings are also different, despite simultaneous, for functions and for
non-functions.  Over these two, properties allow one to simulate many
concurrent flavours of bindings to symbols.  Evaluation contexts may also be
fully switched through usage of alternate obstacks.

Now, key bindings are another kind of binding which does not work exactly
like variables, yet the project quoted above might be wise to consider as
well.  For example, key bindings may be associated with limited text areas
within buffers, and while the cursor moves between windows, or over text
within windows, key bindings may change quite often.  Emacs uses heaps (some
call them priority stacks) for tracking these changes.

So, all in all, in real practice, we have a flurry of different types and
qualities of bindings with Emacs, and a variety of implementation techniques
for them.  It would not be wise to underestimate the problem, or to quickly
dismiss this complexity as being gratuitous.

-- 
François Pinard   http://www.iro.umontreal.ca/~pinard





More information about the Python-list mailing list