[swift-evolution] named parameters

Tino Heth 2th at gmx.de
Sat Jan 23 08:02:27 CST 2016


>>> If the library author decides to change the internal name, it's now a source-breaking change for clients. (Alternately, all the existing internal names are now external names, without any thought given to them, which would be just as bad.)
>> Imho this is no good argument — you can extend it to ban all labels.
> 
> No, that's not the case. External names are part of the method name and signature and are part of the source and binary interface for a library. Internal names are local variables with a little bit of documentation. Every parameter has both internal and external names; it's just that the logic for what happens when you only specify one that's different.
I'm not sure if I understand this completely:
When each parameter has an external and an internal name, changing the latter should never be an issue for users of that method… where's the fault in my logic?
The "only"* breaking change I see happens when the behavior for all parameters is unified, and suddenly parameters without external name (or "empty external name"...) would receive one.

>>>> The ability to call a function with a tuple containing the arguments
> 
> In some contexts it's hard to distinguish between "the first parameter" and "the tuple of all parameters", and we have some weird inconsistencies where "foo(x)" and "foo((x))" do the same thing sometimes and different things other times.
> 
> There's more complexity here but I don't have it paged in; it's not so relevant to this discussion
Don't mind — I'm in the lucky position that I don't have to care about the hardships tied to implementation details ;-), so I was just curious if there's danger that the feature will be removed.

Tino

* I guess it would be a huge one...
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160123/0302a796/attachment.html>


More information about the swift-evolution mailing list