On Oct 6, 2006, at 5:24 PM, Craig Hoyt wrote:

It has been driven home to me by many others much smarter than I, don't expect RB to be anything other than what it is. If you fight it - you loose. Seems some want .Count to work the same as .Ubound - they are two different properties. Accept it - live with - know it's one of the thousand other RB gotchas.

The use of Count is consistent throughout REALbasic. What is not consistant is when you have a 1-based accessor like FolderItem or a 0- based accessor like Dictionary.Key(). To make my classes compatible with similar REALbasic core classes, I even emulate REALbasic by having a Computed Property "Count" which has "UBound(theArray) + 1" in its Get field.

I think that usage of 1-based accessors date back when REALbasic was pretty new. You have to admit that it is more difficult for beginning programmers to get used to 0-based arrays, and that was the primary group of users back then. It was even common to create regular arrays where UBound would equal the "Count" of elements you wanted -- you just ignored the 0th element. But as REALbasic and its users matured, so did the transition from 1-based to 0-based begin... and we have a few hold-overs such as FolderItem.

Any of the newer classes (such as Dictionary) will use the 0-based accessors; the problem is remembering or looking up which classes use which. The problem is with legacy code... if you change the behavior then it is going to break a lot of applications/examples and in the case of a FolderItem there will not be any compile warnings... just unexpected behavior.

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Reply via email to