Lisp refactoring puzzle

Terry Reedy tjreedy at
Tue Jul 12 12:49:40 EDT 2011

On 7/11/2011 11:37 PM, Xah Lee wrote:
> watch the first episode of Douglas Crockford's talk here:

The link includes a transcript of the talk, which I read

I suspect Lee likes Crockford because they both think they are smarter 
than everyone else. Writing about Smalltalk, for instance, Crockford says:

"I don't know why it is, but a lot of programmers just couldn't get used 
to this syntax. [everything is done by sending a message with arguments 
to some object] ...So this may be a superior notation, but it was 
profoundly rejected. By who? By us, by the programmers, because we 
couldn't understand it."

Actually, I and others see Smalltalk as deeply flawed because its 
message passing syntax arbitrarily breaks symmetries in operations. For 
instance, in the expression 'a+b', both operands have equivalent roles 
in the operation for all normal interpretations of '+'.# On the other 
hand, in the expression 'a.extend(b)', where a is a list and b any 
iterable and the result is to mutate a but not b, a and b have very 
different roles in both the operation and the expression that invokes it.

# Under the covers, Python implements 'a+b' as first 'a.__add__(b)', but 
it also tries 'b.__radd__(a)' if the first does not work. This 
introduces a slight asymmetry in that a gets first say at defining the 
meaning of 'a+b', but it does not get the only say. And, as far as I can 
presently remember, this asymmetry is never visible with builtins. In 
fact, this implementation makes it possible for 'a+b' and 'b+a' to both 
give the same answer when a is a builtin and b is a user-class instance.

Crockford is right that he does not 'know why it is' that not everyone 
loves Smalltalk. He should have stopped there instead of projecting his 
ignorance on everyone else.

As a side note, the same principle of expressions matching operations in 
symmetry suggest that majority of up are quite sensible and not dumb 
idiots for preferring 'f(x)' to the '(f x)' of Lisp. In a function call, 
the function has a different role than the arguments, so it is 
appropriate that it have a different role in the expression.

Terry Jan Reedy

More information about the Python-list mailing list