Could Emacs be rewritten in Python?
Alex Martelli
aleax at aleax.it
Tue Apr 15 08:29:49 EDT 2003
Michael Hudson wrote:
> Alexander Schmolck <a.schmolck at gmx.net> writes:
>
>> > Requiring declarations of all variables would be a HUGE change to
>> > Python, IMHO.
>>
>> Sure and I'm in no way arguing for such a change (and neither Paul
>> Foley who, unlike me, considers implicit declaration a major
>> flaw). I just don't understand why it would "unfeasible
>> syntactically" -- *syntactically* it seems quite unproblematic to
>> me.
>
> Well, maybe I should have been more clear than just "syntactically" --
> but you do understand what I mean, no? I don't think you can
> distingusish establishment and mutation of bindings in Python without
> significant damage to the "feel" of the language.
I think you COULD choose to add to Python two special assignment
delimiters -- say := and ~= for definiteness -- with semantics as
follows:
<name> := <expression>
if <name> was previously unbound in this scope, bind it;
if <name> was already bound, raise an exception.
<name> ~= <expression>
if <name> was already bound in this scope, re-bind it;
if <name> was previously unbound, raise an exception.
while leaving good old = to mean exactly what it means today.
Would such additions "significantly damage the feel of the
language"? I don't know. I doubt they'd add any important
expressiveness, or see any significant use; therefore, in
practice, I think they'd remain obscure, rarely-used "dusty
corners of the language" and thereby indirectly do some
damage (complexity not pulling its weight). But I don't see
any sense in which these difficulties could possibly be
described as "syntactical", even lato sensu.
Alex
More information about the Python-list
mailing list