At 9:04 PM -0600 2/18/07, Guyren Howe wrote: >0 is more natural for programming, IMHO. > >You'll notice that the original designer of REALbasic tried to deal >with this intelligently. So rather than a Count(Array), we have >UBound(Array), so you can index from 0 to that and it works.
We've discussed this at great length on the list before, as Terry will likely point out. :-) My philosophy is that 0 based makes the most sense if you're dealing with OFFSETS, and 1 based makes the most sense if you're dealing with LISTS. Low level languages are constantly dealing with offsets from some sort of base address or pointer and thus 0 based addressing is most appropriate, since the first element is at zero offset from the base address. High level languages deal most frequently with lists of abstracted objects. There is no base address nor base pointer, there are only first second and third objects. Hence for high level languages a 1 based system makes the most sense. The first item has index 1, the second items has index 2 and the size of the list equals its Count. Banishes the off-by-one boundary problems. Other than the memoryblock, which is a low level construct, I can't think of anything in RB that has a base address and we access via an offset??? So I've always wished that RB was one based so that Object Count and Looping were consistent and not always off by one. But of course it's far too late to change this now. Regards, Joe Huber _______________________________________________ Unsubscribe or switch delivery mode: <http://www.realsoftware.com/support/listmanager/> Search the archives: <http://support.realsoftware.com/listarchives/lists.html>
