From: Ken Bloom Date: 2007-07-20T09:10:01+09:00 Subject: Re: The Pebble in the Ruby Shoe On Mon, 16 Jul 2007 22:22:05 +0900, Raphael Gillett wrote: > Ruby aims to be a human friendly programming language that embodies the > principle of least surprise. However, there is an important feature of > the language that, despite being a glaring exception to this laudable > goal, seems to have crept unquestioned into the Ruby core. It is a > rebarbative and truly medieval practice which everyone knows causes > endless confusion, countless unnecessary errors, and a great deal of > wasted programming time in all languages that incorporate it, e.g., C, > Java. In violation of Ruby's ethos, this feature is present purely to > suit the compiler/interpreter at the expense of the person. > > The pebble in the Ruby shoe is the counter-intuitive use of indexing of > elements of arrays, strings, etc., from 0 to n-1 instead of the more > natural 1 to n. Like prisoners who have got used to their chains, the > Ruby community seems to have meekly accepted this impediment to clear > thinking. It is particularly puzzling that Ruby should hobble its > users in this way, because it is manifestly unnecessary (e.g., Fortran > and Pascal don't do it). If you were going to argue for arbitrarily indexed arrays e.g. those ranging from 47 thru 300 or from -26 thru 68, you might have a point that there's something more natural in your proposal. (Although it would break other features of arrays that we hold very dear to our hearts.) Arguing 1-based arrays to replace 0-based arrays is arbitrary at best, and unnatural at worst. -- Ken Bloom. PhD candidate. Linguistic Cognition Laboratory. Department of Computer Science. Illinois Institute of Technology. http://www.iit.edu/~kbloom1/