Allow for NSEnumerationOptions to be passed in to fast enumeration (for x in y)

Originator:zach
Number:rdar://10981526 Date Originated:04-Mar-2012 04:38 PM
Status:Open Resolved:
Product:Developer Tools Product Version:Apple clang version 4.0 (t/A/418.0.46)
Classification:Enhancement Reproducible:N/A
 
04-Mar-2012 04:38 PM Zach Drayer:
Fast enumeration, in the form of `for (x in y) {}` is a great way to enumerate over a collection of objects. However, there are times when it is not the most efficient way to enumerate over a collection.

Some of the time, the operation being performed in the loop can be done concurrently, in which case -enumerateObjectsWithOptions:usingBlock: is a better way to go. This is because it allows for the `NSEnumerationConcurrent` to be passed in when running the method. 

It would be absolutely fantastic if fast enumeration was expanded to add `for (x in y with z) {}`, where `z` is a set of NSEnumerationOptions that can be passed in. 

This is also very helpful because devices are shipping with more and more CPUs (Macs typically have 4 CPUs by now, and iPhone's/iPad's shipping at the moment can have 2 CPUs), and despite GCD being awesome, there are still times when it is hard for developers to fully take advantage of all of the CPUs available to them.

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!