<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">To re-iterate my comment on github; I think this is a great idea.&nbsp;<div class=""><br class=""></div><div class="">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).&nbsp;</div><div class=""><br class=""></div><div class="">Most likely future optimizations in c and objective c code can be applied in addition to the positive effect to swift code.</div><div class=""><div class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Dec 8, 2015, at 12:02 AM, Jacob Bandes-Storch via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">Alright, I've written up a proposal:&nbsp;<a href="https://github.com/apple/swift-evolution/pull/40" class="">https://github.com/apple/swift-evolution/pull/40</a><br class=""><div class="gmail_extra"><br class="">Feedback welcome!</div><div class="gmail_extra"><br clear="all" class=""><div class=""><div class="gmail_signature"><div dir="ltr" class=""><div class="">Jacob<br class=""></div></div></div></div><br class=""><div class="gmail_quote">On Sat, Dec 5, 2015 at 2:25 PM, Jacob Bandes-Storch<span class="Apple-converted-space">&nbsp;</span><span dir="ltr" class="">&lt;<a href="mailto:jtbandes@gmail.com" target="_blank" class="">jtbandes@gmail.com</a>&gt;</span><span class="Apple-converted-space">&nbsp;</span>wrote:<br 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 dir="ltr" class=""><span class=""><div class="">On Sat, Dec 5, 2015 at 1:40 PM, Tony Parker<span class="Apple-converted-space">&nbsp;</span><span dir="ltr" class="">&lt;<a href="mailto:anthony.parker@apple.com" target="_blank" class="">anthony.parker@apple.com</a>&gt;</span><span class="Apple-converted-space">&nbsp;</span>wrote:<br class=""></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;" class=""><div class="">One topic I wanted to discuss was finding a comprehensive list of API that needs the attribute.</div></div></blockquote><div class=""><br class=""></div></span><div class="">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 class=""></div><div class=""><br class=""></div><div class="">- bsearch, heapsort,&nbsp;qsort, mergesort, psort, and their _b variants</div><div class=""><br class=""></div><div class="">"passing test" methods:</div>- -[{NSArray,NSOrderedSet} indexOfObjectPassingTest:]</div><div class="gmail_quote">- -[{NSArray,NSOrderedSet}&nbsp;indexesOfObjectsPassingTest:]</div>- -[{NSArray,NSOrderedSet}&nbsp;indexOfObjectsAtIndexes:passingTest:]</div><div class="gmail_extra">- -[{NSArray,NSOrderedSet}&nbsp;indexesOfObjectsAtIndexes:passingTest:]</div>- -[SCNNode childNodesPassingTest:]<br class="">- -[SCNSceneSource entriesPassingTest:]<div class="">- -[AVAudioUnitComponentManager componentsPassingTest:]</div><div class="">- -[NSIndexSet indexPassingTest:]</div>- -[NSIndexSet indexWithOptions:passingTest:]<div class="">- -[NSIndexSet indexesPassingTest:]</div><div class="">- -[NSIndexSet indexesWithOptions:passingTest:]<br class=""></div><div class="">- -[NSIndexSet indexInRange:options:passingTest:]<br class=""><div class="">- -[NSIndexSet indexesInRange:options:passingTest:]</div><div class="">- -[NSSet objectsPassingTest:]</div><div class="">- -[NSSet objectsWithOptions:passingTest:]<br class=""></div><div class="">- -[NSDictionary keysOfEntriesPassingTest:]</div>- -[NSDictionary keysOfEntriesWithOptions:passingTest:]</div><div class=""><br class=""></div><div class="">"using comparator" methods:</div><div class="">- -[NSArray indexOfObject:inSortedRange:options:usingComparator:]</div>- -[NSArray sortedArrayUsingComparator:]<br class="">- -[NSArray sortedArrayWithOptions:usingComparator:]<div class="">- -[NSDictionary keysSortedByValueUsingComparator:]<br class="">- -[NSDictionary keysSortedByValueWithOptions:usingComparator:]</div><div class="">- -[NSMutableArray sortUsingComparator:]<br class=""></div><div class="">- -[NSMutableArray sortWithOptions:usingComparator:]</div>- -[NSMutableOrderedSet&nbsp;sortWithOptions:usingComparator:]<div class="">- -[NSMutableOrderedSet sortRange:options:usingComparator:]</div><div class=""><br class=""></div><div class="">&nbsp;(and some of these have "usingFunction" variants)<br class=""><div class=""><br class=""></div><div class="">"enumerate using block" methods:</div><div class="">- -[NSTableView enumerateAvailableRowViewsUsingBlock:]<br class="">- -[SKPhysicsWorld enumerateBodiesAtPoint:usingBlock:]</div><div class="">- -[SKPhysicsWorld enumerateBodiesInRect:usingBlock:]</div><div class="">- -[NSData enumerateByteRangesUsingBlock:]</div><div class="">- -[SCNNode enumerateChildNodesUsingBlock:]</div><div class=""><div class="">- -[SCNNode enumerateChildNodesWithName:usingBlock:]</div><div class="">- -[NSIndexSet enumerateIndexesUsingBlock:]</div><div class=""><div class="">- -[NSIndexSet enumerateIndexesWithOptions:usingBlock:]</div>- -[NSDictionary enumerateKeysAndObjectsUsingBlock:]</div><div class="">- -[NSDictionary enumerateKeysAndObjectsWithOptions:usingBlock:]<br class=""></div><div class="">- -[NSString enumerateLinesUsingBlock:]</div>- -[NSString enumerateSubstringsInRange:options:usingBlock:]</div><div class="">- -[{NSArray,NSSet,NSOrderedSet} enumerateObjectsUsingBlock:]<br class="">- -[{NSArray,NSSet,NSOrderedSet} enumerateObjectsWithOptions:usingBlock:]</div><div class="">- -[NSIndexSet enumerateRangesUsingBlock:]<br class=""></div><div class="">- -[NSIndexSet enumerateRangesWithOptions:usingBlock:]<br class=""></div><div class="">- -[NSIndexSet enumerateRangesInRange:options:usingBlock:]<div class="">- -[MPMediaEntity enumerateValuesForProperties:usingBlock:]</div><div class="">- -[NSMetadataQuery enumerateResultsUsingBlock:]</div><div class="">- -[NSMetadataQuery enumerateResultsWithOptions:usingBlock:]</div><div class=""><br class=""></div><div class="">misc:<br class="">- -[NSDocument performSynchronousFileAccessUsingBlock:]<br class=""></div><div class=""><br class=""></div><div class="">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 class=""><br class=""></div><div class="">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" class=""><div class=""><br class=""></div><div class="">Jacob Bandes-Storch</div></font></span></div></div></div></blockquote></div><br class=""></div></div><img src="https://u2002410.ct.sendgrid.net/wf/open?upn=0mkChau6XnFV-2FCNUik62L9ZaldD0W0ziOwj-2F3jLx368RYmv5gdYwEx-2F0tJ1bbQWS8aSmPaBymI5ALe5ljBGOT5GdcloZfb-2F-2FlPzYC5LKGD-2B44RN1aeBp-2BXZAzZ-2FyIy1Ed8F7GigFZ1O1SYCxhV-2FBNGAW2k6DZ7-2FZfJMCFTmKps14oTt3ZVJoS8lrbWmCsdZHfyE7xCDrVQvG-2By-2BZDLsB9bEWG1qOgRdegCbMftKJWzM-3D" alt="" width="1" height="1" border="0" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; height: 1px !important; width: 1px !important; border-width: 0px !important; margin: 0px !important; padding: 0px !important;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class=""><span class="Apple-converted-space">&nbsp;</span>_______________________________________________</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">swift-evolution mailing list</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><a href="mailto:swift-evolution@swift.org" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">swift-evolution@swift.org</a><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">https://lists.swift.org/mailman/listinfo/swift-evolution</a></div></blockquote></div><br class=""></div></div></body></html>