Could Emacs be rewritten in Python?

Carl Banks imbosol-1049687461 at aerojockey.com
Mon Apr 7 00:03:18 EDT 2003


Alexander Schmolck wrote:
> Carl Banks <imbosol-1049649076 at aerojockey.com> writes:
>> Next three functions are "save-current-buffer", "with-current-buffer",
>> and "with-temp-buffer".  These are actually not functions, but special
>> forms and macros.  Python has no analogue to these (barring some
>> obscure metaclass tricks). 
> 
> Care to share the obscure metaclass trick to implement with-* style macros in
> python?

I doubt it'll work for with-style macros, but this shows how to do a
conditional operator:

http://tinyurl.com/8yne


>> There is one potentially disasterous pitfall you should be aware of.
>> Emacs does all kinds of strange things with namespaces.  It uses
>> dynamic binding, unlike Python, which uses lexical binding.  Emacs has
>> one monolithic global namespace, as opposed to Python, which has an
>> organized infrastructure of "global" namespaces, that is, modules.
>> Also, Emacs has weird namespaces like buffer local variables.  One
>> thing you'll have to do is think about how to sort all these namespace
>> issues out.
> 
> Yes, these are minor issues (BTW you forgot to mention that emacs also has
> separate namespaces for functions/macros and variables (and, in a slightly
> different way, lots of other things)).

Good point.  I think namespace is a major issue, especially if you're
going to follow the Lisp code.


-- 
CARL BANKS




More information about the Python-list mailing list