[swift-evolution] [Pitch] Allow trailing argument labels
swift-evolution at haravikk.me
Wed Feb 22 13:47:58 CST 2017
> On 22 Feb 2017, at 15:38, Vladimir.S <svabox at gmail.com> wrote:
> Do I understand correctly, that the proposed solution is some kind of sugar to not have separate method named like 'addingWithReportingOverflow' ?
Basically yes; the discussion came up briefly during protocol oriented integers where this is quite common, especially with added methods for handling double-width operations and such as well.
> In any case IMO such argument label should have special syntax on caller site.. don't know, probably:
> let resultWithOverflow = a.adding(b, :reportingOverflow)
> probably with the same declaration:
> func adding(_ other:Self, :reportingOverflow) -> (Self, Bool)
Huh, that could be a great alternative! It would solve the ambiguity issues completely and allow for even single argument cases (if someone wanted to use those).
Any preferences on how to specify these arguments? e.g- just declare them void, attribute or something else?
Also apologies to Patrick, I seem to be leading his discussion, I really should get some work done! 😄
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the swift-evolution