<div dir="ltr">Alright, I've written up a proposal: <a href="https://github.com/apple/swift-evolution/pull/40">https://github.com/apple/swift-evolution/pull/40</a><br><div class="gmail_extra"><br>Feedback welcome!</div><div class="gmail_extra"><br clear="all"><div><div class="gmail_signature"><div dir="ltr"><div>Jacob<br></div></div></div></div>
<br><div class="gmail_quote">On Sat, Dec 5, 2015 at 2:25 PM, Jacob Bandes-Storch <span dir="ltr"><<a href="mailto:jtbandes@gmail.com" target="_blank">jtbandes@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><span class=""><div>On Sat, Dec 5, 2015 at 1:40 PM, Tony Parker <span dir="ltr"><<a href="mailto:anthony.parker@apple.com" target="_blank">anthony.parker@apple.com</a>></span> wrote:<br></div></span><div class="gmail_extra"><div class="gmail_quote"><span class=""><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div style="word-wrap:break-word"><div>One topic I wanted to discuss was finding a comprehensive list of API that needs the attribute.</div></div></blockquote><div><br></div></span><div>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.<br></div><div><br></div><div>- bsearch, heapsort, qsort, mergesort, psort, and their _b variants</div><div><br></div><div>"passing test" methods:</div>- -[{NSArray,NSOrderedSet} indexOfObjectPassingTest:]</div><div class="gmail_quote">- -[{NSArray,NSOrderedSet} indexesOfObjectsPassingTest:]</div>- -[{NSArray,NSOrderedSet} indexOfObjectsAtIndexes:passingTest:]</div><div class="gmail_extra">- -[{NSArray,NSOrderedSet} indexesOfObjectsAtIndexes:passingTest:]</div>- -[SCNNode childNodesPassingTest:]<br>- -[SCNSceneSource entriesPassingTest:]<div>- -[AVAudioUnitComponentManager componentsPassingTest:]</div><div>- -[NSIndexSet indexPassingTest:]</div>- -[NSIndexSet indexWithOptions:passingTest:]<div>- -[NSIndexSet indexesPassingTest:]</div><div>- -[NSIndexSet indexesWithOptions:passingTest:]<br></div><div>- -[NSIndexSet indexInRange:options:passingTest:]<br><div>- -[NSIndexSet indexesInRange:options:passingTest:]</div><div>- -[NSSet objectsPassingTest:]</div><div>- -[NSSet objectsWithOptions:passingTest:]<br></div><div>- -[NSDictionary keysOfEntriesPassingTest:]</div>- -[NSDictionary keysOfEntriesWithOptions:passingTest:]</div><div><br></div><div>"using comparator" methods:</div><div>- -[NSArray indexOfObject:inSortedRange:options:usingComparator:]</div>- -[NSArray sortedArrayUsingComparator:]<br>- -[NSArray sortedArrayWithOptions:usingComparator:]<div>- -[NSDictionary keysSortedByValueUsingComparator:]<br>- -[NSDictionary keysSortedByValueWithOptions:usingComparator:]</div><div>- -[NSMutableArray sortUsingComparator:]<br></div><div>- -[NSMutableArray sortWithOptions:usingComparator:]</div>- -[NSMutableOrderedSet sortWithOptions:usingComparator:]<div>- -[NSMutableOrderedSet sortRange:options:usingComparator:]</div><div><br></div><div> (and some of these have "usingFunction" variants)<br><div><br></div><div>"enumerate using block" methods:</div><div>- -[NSTableView enumerateAvailableRowViewsUsingBlock:]<br>- -[SKPhysicsWorld enumerateBodiesAtPoint:usingBlock:]</div><div>- -[SKPhysicsWorld enumerateBodiesInRect:usingBlock:]</div><div>- -[NSData enumerateByteRangesUsingBlock:]</div><div>- -[SCNNode enumerateChildNodesUsingBlock:]</div><div><div>- -[SCNNode enumerateChildNodesWithName:usingBlock:]</div><div>- -[NSIndexSet enumerateIndexesUsingBlock:]</div><div><div>- -[NSIndexSet enumerateIndexesWithOptions:usingBlock:]</div>- -[NSDictionary enumerateKeysAndObjectsUsingBlock:]</div><div>- -[NSDictionary enumerateKeysAndObjectsWithOptions:usingBlock:]<br></div><div>- -[NSString enumerateLinesUsingBlock:]</div>- -[NSString enumerateSubstringsInRange:options:usingBlock:]</div><div>- -[{NSArray,NSSet,NSOrderedSet} enumerateObjectsUsingBlock:]<br>- -[{NSArray,NSSet,NSOrderedSet} enumerateObjectsWithOptions:usingBlock:]</div><div>- -[NSIndexSet enumerateRangesUsingBlock:]<br></div><div>- -[NSIndexSet enumerateRangesWithOptions:usingBlock:]<br></div><div>- -[NSIndexSet enumerateRangesInRange:options:usingBlock:]<div>- -[MPMediaEntity enumerateValuesForProperties:usingBlock:]</div><div>- -[NSMetadataQuery enumerateResultsUsingBlock:]</div><div>- -[NSMetadataQuery enumerateResultsWithOptions:usingBlock:]</div><div><br></div><div>misc:<br>- -[NSDocument performSynchronousFileAccessUsingBlock:]<br></div><div><br></div><div>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).</div><div><br></div><div>Arguably, the "enumerateXUsingBlock:" pattern should be bridged to Swift as something SequenceType-ish which can be `for-in`ed.</div><span class=""><font color="#888888"><div><br></div><div>Jacob Bandes-Storch</div></font></span></div></div></div>
</blockquote></div><br></div></div>