On Dec 4, 2007 12:24 PM, Bill Bumgarner <email@hidden> wrote:
> On Dec 4, 2007, at 5:41 AM, Jonathan deWerd wrote:
> > Apple probably thought you could make your own foreach macro +
> > protocol if you had a truly compelling reason to do so. Instead of
> > using an array of NSValues, you can also make your own NSArray
> > subclass to handle C arrays of whatever you would like (or even
> > perhaps an arbitrary type).
> Actually, even subclassing NSArray is not going to give you an
> efficient means of handling non Objective-C object types. NSArray is
> fundamentally designed to contain objects.
Sorry, I thought it was obvious from context that if you have the need
for returning alternate types, as illustrated, you're almost certainly
managing your own internal data structures and are not subclassing
NSArray (or any other standard collection type).
As a concrete example, the regular expression framework that I've
developed could definitely use the ability to fast enumerate arbitrary
types, specifically NSRange's. Internal to the framework and classes,
regular expression match information is stored as NSRanges, and the
ability to fast enumerate both sub-captures of a given match, and
repeated matches of a regular expression over a given string, would be
returned as a pointer to an array of the internal NSRange structures.
As currently implemented in objc2, I can't use the for...in language
feature to accelerate the enumeration of this NSRange information, yet
it is precisely the type of thing it was meant to address.
Do not post admin requests to the list. They will be ignored.
Objc-language mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden