Could Emacs be rewritten in Python?

Alexander Schmolck a.schmolck at gmx.net
Wed Apr 9 15:44:29 EDT 2003


Beni Cherniavsky <cben at techunix.technion.ac.il> writes:

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

Why not? Amongst other things dynamically scoped global variables seems the
only sane way to me to have global variables. Otherwise, everytime you screw
around with some global variable temporarily you have to go through all sorts
of pain making sure you clean it up after you're done (even if something went
wrong) and you'd better not be multithreaded. Compare:

# simple, single threaded case
try:
   global precision
   old = precision
   precision = 10e-10
   dosomething()
finally:
   precision = old

(let ((precision 10e-10)) (dosomething))

> Note that the listed motivation is mainly implemention simplicity and
> effeciency. 

Well yes, but emacs lisp is decades old. GC was also inefficient 20 years ago,
now memory handling by hand is not only a pain but also most likely slower.

> 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 :-)...

I think that's wrong. Common Lisp has both dynamic scope (for globals and
everything and locals your explicitly declare so) and lexical scope and I
think lookup for the dynamically scoped variables is slower.

'as




More information about the Python-list mailing list