On Apr 25, 2006, at 5:20 PM, Charles Yeomans wrote:
Not quite; this is approximately true for arrays. The "for each"
construction is better viewed as an attempt to provide language
support for iteration through the contents of an array. You could
think of it as support for the Iterator pattern (for Rb arrays) just
as events are the expression of the Template pattern in the language.
Unless things have changed, 'for each' does not guarantee iteration
using the array order; I consider this a shortcoming, as it is
reasonable to expect that iteration over an ordered structure respect
that order.
Good points, as always. I forgot that "for each" is not guaranteed to
iterate in order. I was thinking of this:
for each instance as type in theArray
next
as being equivalent to this:
for i as integer = 0 to ubound( theArray )
dim instance as type = theArray( i )
next
When in reality, they are not equivalent.
-- Asher
_______________________________________________
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>