[swift-evolution] Removing Variadic Parameters.

Rob Mayoff mayoff at dqd.com
Wed Jul 6 20:28:10 CDT 2016


On Wed, Jul 6, 2016 at 2:57 PM, Tino Heth via swift-evolution
<swift-evolution at swift.org> wrote:
> Can you talk about concrete examples? Because Objective-C had no variadic messages, it's natural that the feature isn't utilized in Cocoa

Objective-C has variadic messages. I'd be surprised if any seasoned
Objective-C developer hasn't used `+[NSString stringWithFormat:]`.

These are most of the variadic messages in the El Capitan SDK:

-[NSGradient initWithColorsAndLocations:]
-[AMAction logMessageWithLevel:format:]
-[CIFilter apply:]
+[CISampler samplerWithImage:keysAndValues:]
-[CISampler initWithImage:keysAndValues:]
+[NSArray arrayWithObjects:]
-[NSArray initWithObjects:]
-[NSCoder encodeValuesOfObjCTypes:]
-[NSCoder decodeValuesOfObjCTypes:]
+[NSDictionary dictionaryWithObjectsAndKeys:]
-[NSDictionary initWithObjectsAndKeys:]
+[NSException raise:format:]
-[NSException handleFailureInMethod:object:file:lineNumber:description:]
-[NSException handleFailureInFunction:file:lineNumber:description:]
+[NSExpression expressionWithFormat:]
+[NSOrderedSet orderedSetWithObjects:]
-[NSOrderedSet initWithObjects:]
+[NSPredicate predicateWithFormat:]
+[NSSet setWithObjects:]
-[NSSet initWithObjects:]
-[NSString stringByAppendingFormat:]
-[NSString initWithFormat:]
-[NSString initWithFormat:locale:]
+[NSString stringWithFormat:]
+[NSString localizedStringWithFormat:]
-[NSString appendFormat:]
-[SBObject  sendEvent:id:parameters:]


More information about the swift-evolution mailing list