Counting from zero
helbig at Lehre.BA-Stuttgart.DE
Mon May 1 22:26:22 UTC 2006
>I find Laurence's solution very elegant. I can even imagine adding a
>method to Integer:
>^ self + 1
>Then you could have:
>someCollection at: 5 countZero
>Legible and simple, what do you say?
Rejected! Proposals like yours and Laurence's are steps towards the wrong
Because they add complexity without neccessity. Programs will be harder to
understand, protocols will be harder to specify and programs will be harder to
write and prove correct if one always has to keep in mind which type of indexing
is used today. It looks far clearer to me to have one kind of indexing instead
of two, even if the one turns out to lead to clumpsy programs at times. Just
learn to cope with it. At least for the time being.
I'd refrain from trying to mix Smalltalk and C. This leads to monster languages
like Java, C++ or C#, that are much harder to master than Smalltalk even though
they start indexing at zero.
The Romans sayed:
Simplex Veri Sigillum
Simplicity is the hallmark of truth
And I'd like to add
Simplicity is the hallmark of Smalltalk
Weniger, aber besser.
More information about the Squeak-dev