<br><br><div><span class="gmail_quote">On 5/1/06, <b class="gmail_sendername">Hans-Martin Mosner</b> &lt;<a href="mailto:hmm@heeg.de">hmm@heeg.de</a>&gt; wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Wolfgang Helbig wrote:<br><br>&gt;<br>&gt;The last sentences are purely speculative and Dennis might shed some light on<br>&gt;them. But it is not speculative that Smalltalk is the only programming language<br>&gt;that allows indexed variables and forces the programmer to use one as the first
<br>&gt;index. If you find another one let me know.<br>&gt;<br>&gt;<br><a href="http://en.wikipedia.org/wiki/Array">http://en.wikipedia.org/wiki/Array</a> lists BASIC and Fortran as having<br>1-based array indexing, and it even discusses some of the relative
<br>merits of and arguments for 0-based and 1-based array indexing.<br>Which one is more natural is a matter of personal taste and opinion. In<br>most everyday programming situations I consider the 1-based approach<br>much more natural, but the low-level stuff where you're addressing
<br>hardware is definitely an exception which can be handled pretty well by<br>implementing a specialized arrayed class which does 0-based indexing.<br>Having learned BASIC as a first language in school, I found C's<br>convention of 0-based indexing pretty awkward, until I realized that C
<br>is mostly a kind of portable assembly language which lets you get close<br>to the hardware. It's not a language I would consider well suited for<br>expression my thoughts in a program...<br>The question is: do we want to let hardware characteristics dominate our
<br>way of thinking? I at least don't. When I've got 5 elements in a<br>collection, I want the first at index 1 and the fifth at index 5. When<br>I'm using Integers, I don't want to think about 16 vs 32 bits, signed vs<br>
unsigned etc.<br>The argument about loop bounds is somewhat related. I've seen quite some<br>beginner's C code which did &quot;for (i=0; i&lt;=10; i++)&quot; to address a<br>10-element array :-) Seasoned C programmers don't do that anymore, but
<br>it tells me a bit about what is &quot;natural&quot; :-)</blockquote><div><br>So true. The admonition &quot;remember arrays start at zero&quot; is repeated countless times in most literature. You see this in just about every article or book on most modern languages. If it were so &quot;natural&quot; to count groups of things from 0 people wouldn't need to be reminded constantly. 
<br><br>Regards,<br>Laurence<br></div><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Cheers,<br>Hans-Martin<br><br></blockquote></div><br>