Python syntax in Lisp and Scheme

Christopher C. Stacy cstacy at dtpq.com
Wed Oct 8 18:08:13 EDT 2003


>>>>> On Wed, 08 Oct 2003 16:51:44 -0400, Joe Marshall ("Joe") writes:
 Joe> "Carlo v. Dango" <oest at soetu.eu> writes:

 >> method overloading,

 Joe> Now I'm *really* confused.  I thought method overloading involved
 Joe> having a method do something different depending on the type of
 Joe> arguments presented to it.  CLOS certainly does that.

He probably means "operator overloading" -- in languages where
there is a difference between built-in operators and functions,
their OOP features let them put methods on things like "+".

Lisp doesn't let you do that, because it turns out to be a bad idea.
When you go reading someone's program, what you really want is for
the standard operators to be doing the standard and completely 
understood thing.   Most commonly, the operators that people in C++
like to overload are the mathematical ones, like "*" and "+".
Lisp has carefully defined those operations to do all the things
that are both well-understood (like complex numbers) and missing
from languages like C++.    And in Lisp if you want to do some 
other kind of arithmetic, you must make up your names for those
operators.  This is considered to be a good feature.

Not surprisingly, the designers of JAVA understood this as well:
JAVA doesn't let you overload operators, either.




More information about the Python-list mailing list