[swift-evolution] named parameters

davesweeris at mac.com davesweeris at mac.com
Sat Jan 23 01:00:34 CST 2016


Plus, functions who’s signatures differ only by the argument labels would become inherently ambiguous if the labels were optional.

- Dave Sweeris

> On Jan 22, 2016, at 15:36, Dave Abrahams via swift-evolution <swift-evolution at swift.org> wrote:
> 
> 
> on Fri Jan 22 2016, Tino Heth <swift-evolution at swift.org> wrote:
> 
>> Especially because of the benefit of labels, it's imho not necessary
>> that the compiler enforces their use… but I think it's actually
>> annoying to be forced to skip labels:
>> 
>> func printPowWithBase(base: Double, exponent: Double) {
>> 	print(pow(base, exponent))
>> }
>> printPowWithBase(2, exponent: 3)
>> 
>> Easy to understand, works as expected — but would it hurt if
>> 
>> printPowWithBase(base: 2, exponent: 3)
>> 
>> would be accepted as well? Sure, "base:" is redundant, but who cares?
> 
> I do. This kind of cruft adds up, and makes code much harder to read.
> Also, FWIW, I would like calls to a given method to look the same in
> most contexts.
> 
> -- 
> -Dave
> 
> _______________________________________________
> 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