[swift-evolution] [Idea] Passing an Array to Variadic Functions
Goffredo Marocchi
panajev at gmail.com
Mon Apr 18 14:22:47 CDT 2016
Let's build strings the same way we log.... String("\(authorOfAutoLayoutMasterBook) could you please show \(canICountHowMany) times more love to \(ToolThatBuildsInterfaces) :)") ^_^ ?
[[iOS messageWithData:ideas] broadcast]
> On 18 Apr 2016, at 20:06, Erica Sadun via swift-evolution <swift-evolution at swift.org> wrote:
>
>
>> On Apr 18, 2016, at 1:01 PM, Tony Allevato via swift-evolution <swift-evolution at swift.org> wrote:
>>
>> I would also be supportive of removing varargs for now, in favor of a rethought design when generics are completed.
>>
>> In their current form, varargs are fairly limited—because they're mapped onto an array, the argument types must be homogeneous, so either your function can only usefully take a single type of argument, or you potentially lose information because they have to be upcast to a common supertype or Any in order to build the array.
>>
>> I'm not convinced that varargs produce code that is much cleaner than the array version. Is this:
>>
>> String(format: "%@ is %d years old", name, age)
>>
>> that much cleaner than:
>>
>> String(format: "%@ is %d years old", arguments: [name, age])
>
> I would like to see format strings go away and be replace with safer inline annotations.
>
> -- E, somewhat agnostic on variadics
>
>
>
> _______________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org
> https://lists.swift.org/mailman/listinfo/swift-evolution
More information about the swift-evolution
mailing list