Could Emacs be rewritten in Python?

Beni Cherniavsky cben at techunix.technion.ac.il
Wed Apr 9 20:00:57 CEST 2003


Greg Ewing (using news.cis.dfn.de) wrote on 2003-04-09:

> Skip Montanaro wrote:
> > Look again.  In Elisp, when foo() looks up the value of case-fold-search it
> > will find the value defined in the let statement inside bar() because it's
> > lexically scoped  (looks up the call chain for values).
>
> Your terminology is confused -- that's *dynamic* scoping.
>
> > If this was Python, the reference to case-fold-search in foo()
> > would be resolved at the global scope because Python is statically
> > scoped (looks in locals, globals, then builtins only
>
> *This* is called lexical scoping (since the scope is determined
> by where the code is written). (Although calling it "static"
> is correct too, since it's not dynamic.)
>
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

Note the difference between scope and extent and how the confusing "X
scoping" terminology maps to it.

It also describes some implementation details - not that I believe we
want dynamic scope...  Note that the listed motivation is mainly
implemention simplicity and effeciency.  I read somewhere that this is
no longer true but for a long time dynamic scope was considered faster
even for compiled code because so much effort of LISP hackers went
into optimizing it in clever ways :-)...

-- 
Beni Cherniavsky <cben at tx.technion.ac.il>





More information about the Python-list mailing list