isComplex name is bad

nicolas cellier ncellier at ifrance.com
Tue Feb 7 21:35:19 UTC 2006


I do not like the name Complex.
I would prefer ComplexNumber.

Why ? see implementors of isComplex. There are several ones.

The meaning of the message is (isKindOf: Complex) in Object and in Complex.
But it has other meaning elsewhere (like is something complicated).
And some class can be complicated but not KindOf: Complex...

a better message would be isComplexNumber as stated in this comment:
Object>>isComplex
 "Answer true if receiver is a Complex number. False by default."

 ^ false

That does not matter, these classes won't ever mix might you say.
Imagine i want to implement some ComplexMatrix.
Shouldn't it answer true to isComplex ?
Then i will do arithmetic with ComplexNumber and this will fail because both 
class will mis-interpret isComplex as being ComplexNumber or ComplexMatrix...

The right names are definitely isComplexNumber and isComplexMatrix.

Who has the authority and the will to change that ?




More information about the Squeak-dev mailing list