Could Emacs be rewritten in Python?
a.schmolck at gmx.net
Tue Apr 8 18:53:45 CEST 2003
Kim Petersen <kp at kyborg.dk> writes:
> Alexander Schmolck wrote:
> > Kim Petersen <kp at kyborg.dk> writes:
> >> (snip)
> >>function in elisp - do a shallow copy of local variable space (dictionary) and
> >>send it as the local vars - you can safely throw away the dict after function
> > Ahem, there are several thousand variables kicking about in global in emacs,
> > you want to copy them all for each function call?
> look above - *Local* variable space ... globals stay globals.
Maybe we have a misunderstanding.
I thought in your scheme every call to a lisp function foo (from python *or*
another lisp function) is to be implemented by making a copy of the locals and
passing it to foo and this copy is discarded after return. If so, this won't
work (because foo can mess with its callers *locals*; also globals *don't*
stay globals -- a let binding of a global name means it can no longer be
globally modified further up the call tree).
A better example to clarify:
(message "when foo is called folding is: %s" case-fold-search)
(setq case-fold-search :evil))
(message "when bar is called folding is: %s" case-fold-search)
(let ((case-fold-search t))
(message "what did foo do to folding? %s!" case-fold-search))
(message "bar's last folding is: %s again" case-fold-search))
(message "before bar:%s" case-fold-search)
(message "after bar:%s" case-fold-search))
when bar is called folding is: nil
when foo is called folding is: t
what did foo do to folding? :evil! ;; !!!
bar's last folding is: t again
Tell me if you think this would work, too and I'll just reread your message.
More information about the Python-list