new Smalltalk programmer's thoughts

Wolfgang Helbig helbig at Lehre.BA-Stuttgart.DE
Mon May 1 10:25:38 UTC 2006


Hi Stev,
you wrote:
>even if the point of wolfgang was valid but from a C perspective.

and I must frankly admit, that I can't parse that sentence. Ascribe this
to my mother tongue not being English.

So in case you meant my article is valid only from a C programmer's perspective,
let me stress, that my perspective is from a programmer who aims to convince
himself that the program at hand is correct. If you want to attribute this
frame of mind to a profession, I think a mathematician trying to prove a theorem 
is more accurate than a C programmer.

Proving a program being correct while writing it is much easier, if the first 
natural number is zero. This convention leads to more elegant and "natural" 
statements about the state of instance variables.

This is not confined to indexes, but file stream positions as well. The position
is zero after initialization and thus does not address a byte. It needs to be
incremented before it is a valid pointer. This made it much harder to write
and prove the AltoFileStream class correct.

Unix and C let zero be the first natural number. As you might know, the Unix V6 
kernel does not contain a single bug. Ironically, the only V6 program
that I consider buggy is the debugger. Maybe this is because Ken Thompson and
Dennis Ritchie didn't need the debugger. And maybe this is because they were
trying to prove their programs to be correct while writing. And maybe this
is the reason they decided to let zero be the first natural number.

The last sentences are purely speculative and Dennis might shed some light on 
them. But it is not speculative that Smalltalk is the only programming language 
that allows indexed variables and forces the programmer to use one as the first 
index. If you find another one let me know.

Greetings,
Wolfgang

--
Weniger, aber besser.




More information about the Squeak-dev mailing list