ccubed, on 01 March 2012 - 07:06 PM, said:
Binary starts at 0? Binary is just a counting system that uses only a combination of 2 digits (the bi in binary) in an exponential series (each 'place' in the character string represents a value of the base [2] raised to the power of it's position).
Binary doesn't 'start' at 0 any more than decimal, octal, hexadecimal, roman numerals, greek numerals, babylonian numerals, or any other counting system starts at 0.
The person counting decides at what number they start counting. I could start counting at 5,384 if I wanted! That's just a ridiculous number to start at. 0 and 1 are just more convenient starting points...
I actually deal with a couple of systems here at my work that do use a 1-based index for array collections. They are not dead systems like vb6, they're alive and well.
As for OP's suggestion. I'd say no to ALL languages having such a thing. If a language wants to supply such a capability that's all fine and well (which I bet one exists somewhere out there, shit I may even write in one and have no idea it exists), but the idea that this should be common place just leaves the door open for shared libraries to fight over the 'base', or have to have some layer of abstraction between libraries to deal with such nuances, and general standards would just cause them to balance back out to the often agreed upon 0-based index.
If you so want it, write your own collection for it, most all languages have this ability.
This post has been edited by lordofduct: 05 March 2012 - 09:04 AM

New Topic/Question
Reply




MultiQuote


|