To re-iterate my comment on github; I think this is a great idea. There are a couple of suggestions for scope limiting; since this will require changes in the c and objective-c layers to support this attribute it would be good to limit this for now to just the core libraries (dispatch, XCTest and Foundation).
Most likely future optimizations in c and objective c code can be applied in addition to the positive effect to swift code. > On Dec 8, 2015, at 12:02 AM, Jacob Bandes-Storch via swift-evolution > <swift-evolut...@swift.org> wrote: > > Alright, I've written up a proposal: > https://github.com/apple/swift-evolution/pull/40 > <https://github.com/apple/swift-evolution/pull/40> > > Feedback welcome! > > Jacob > > On Sat, Dec 5, 2015 at 2:25 PM, Jacob Bandes-Storch <jtban...@gmail.com > <mailto:jtban...@gmail.com>> wrote: > On Sat, Dec 5, 2015 at 1:40 PM, Tony Parker <anthony.par...@apple.com > <mailto:anthony.par...@apple.com>> wrote: > One topic I wanted to discuss was finding a comprehensive list of API that > needs the attribute. > > On this subject, here are some other APIs which could use the annotation. > Again, I think these should be annotated even in the C/Objective-C headers, > so they can benefit C/Objective-C callers as well. > > - bsearch, heapsort, qsort, mergesort, psort, and their _b variants > > "passing test" methods: > - -[{NSArray,NSOrderedSet} indexOfObjectPassingTest:] > - -[{NSArray,NSOrderedSet} indexesOfObjectsPassingTest:] > - -[{NSArray,NSOrderedSet} indexOfObjectsAtIndexes:passingTest:] > - -[{NSArray,NSOrderedSet} indexesOfObjectsAtIndexes:passingTest:] > - -[SCNNode childNodesPassingTest:] > - -[SCNSceneSource entriesPassingTest:] > - -[AVAudioUnitComponentManager componentsPassingTest:] > - -[NSIndexSet indexPassingTest:] > - -[NSIndexSet indexWithOptions:passingTest:] > - -[NSIndexSet indexesPassingTest:] > - -[NSIndexSet indexesWithOptions:passingTest:] > - -[NSIndexSet indexInRange:options:passingTest:] > - -[NSIndexSet indexesInRange:options:passingTest:] > - -[NSSet objectsPassingTest:] > - -[NSSet objectsWithOptions:passingTest:] > - -[NSDictionary keysOfEntriesPassingTest:] > - -[NSDictionary keysOfEntriesWithOptions:passingTest:] > > "using comparator" methods: > - -[NSArray indexOfObject:inSortedRange:options:usingComparator:] > - -[NSArray sortedArrayUsingComparator:] > - -[NSArray sortedArrayWithOptions:usingComparator:] > - -[NSDictionary keysSortedByValueUsingComparator:] > - -[NSDictionary keysSortedByValueWithOptions:usingComparator:] > - -[NSMutableArray sortUsingComparator:] > - -[NSMutableArray sortWithOptions:usingComparator:] > - -[NSMutableOrderedSet sortWithOptions:usingComparator:] > - -[NSMutableOrderedSet sortRange:options:usingComparator:] > > (and some of these have "usingFunction" variants) > > "enumerate using block" methods: > - -[NSTableView enumerateAvailableRowViewsUsingBlock:] > - -[SKPhysicsWorld enumerateBodiesAtPoint:usingBlock:] > - -[SKPhysicsWorld enumerateBodiesInRect:usingBlock:] > - -[NSData enumerateByteRangesUsingBlock:] > - -[SCNNode enumerateChildNodesUsingBlock:] > - -[SCNNode enumerateChildNodesWithName:usingBlock:] > - -[NSIndexSet enumerateIndexesUsingBlock:] > - -[NSIndexSet enumerateIndexesWithOptions:usingBlock:] > - -[NSDictionary enumerateKeysAndObjectsUsingBlock:] > - -[NSDictionary enumerateKeysAndObjectsWithOptions:usingBlock:] > - -[NSString enumerateLinesUsingBlock:] > - -[NSString enumerateSubstringsInRange:options:usingBlock:] > - -[{NSArray,NSSet,NSOrderedSet} enumerateObjectsUsingBlock:] > - -[{NSArray,NSSet,NSOrderedSet} enumerateObjectsWithOptions:usingBlock:] > - -[NSIndexSet enumerateRangesUsingBlock:] > - -[NSIndexSet enumerateRangesWithOptions:usingBlock:] > - -[NSIndexSet enumerateRangesInRange:options:usingBlock:] > - -[MPMediaEntity enumerateValuesForProperties:usingBlock:] > - -[NSMetadataQuery enumerateResultsUsingBlock:] > - -[NSMetadataQuery enumerateResultsWithOptions:usingBlock:] > > misc: > - -[NSDocument performSynchronousFileAccessUsingBlock:] > > Wow, that's more than I expected to find! This is obviously beyond the scope > of just libdispatch, and I think a lot of these should probably change > upstream, in their original frameworks, internally (not something that > community members can really contribute to). > > Arguably, the "enumerateXUsingBlock:" pattern should be bridged to Swift as > something SequenceType-ish which can be `for-in`ed. > > Jacob Bandes-Storch > > _______________________________________________ > swift-evolution mailing list > swift-evolut...@swift.org <mailto:swift-evolut...@swift.org> > https://lists.swift.org/mailman/listinfo/swift-evolution > <https://lists.swift.org/mailman/listinfo/swift-evolution>
_______________________________________________ swift-corelibs-dev mailing list swift-corelibs-dev@swift.org https://lists.swift.org/mailman/listinfo/swift-corelibs-dev