4 ms·
Edsger Dijkstra on why numbering should start at zero: https://www.cs.utexas.edu/users/EWD/transcriptions/EWD08xx/EWD831.html https://www.cs.utexas.edu/users/EW
by murderfs 8y ago
Edsger Dijkstra on why numbering should start at zero: https://www.cs.utexas.edu/users/EWD/transcriptions/EWD08xx/EWD831.html https://www.cs.utexas.edu/users/EWD/transcriptions/EWD08xx/E...
- kbenson 8y agoWhich is a valid argument for numbering starting at zero, but not just for programming languages, but in general and including human spoken languages. The common counter-argument is "People don't generally think that way unless trained to do so". Like many things in life, often convention and momentum often trump reasoned argument. In general, much of what's chosen for language design is influenced to some degree by convention. This is a valid design choice, because you're maximizing use of existing domain knowledge of your audience. In this specific case, I would argue that since in many languages where an array isn't a small shim over memory management (Ruby, Python, Perl, JS, etc) where easing user friendliness is at a premium over performance, 1 based array indexing would make better sense... if most people adopting those languages weren't already fairly well acquainted with 0 based indexing from CS programs or exposure to other languages (and it wasn't a simple concept to understand). Since many new users are familiar with it, and it is easy to understand, it's simple to just go with what some percentage of people already know, so convention wins out.
- int_19h 8y agoThere are many rebuttals to this claim by Dijkstra, too.
- superlopuh 8y agoFunny how the argument about veering into the unnatural numbers is voided by a Maybe type.
- samatman 8y agoThe One True Wiki has a fairly complete discussion of this question: http://wiki.c2.com/?WhyNumberingShouldStartAtZero http://wiki.c2.com/?WhyNumberingShouldStartAtZero What I find most persuasive is that 0 based indexing brings measurement into accord with enumeration.