[swift-evolution] [Re-Review] SE-0104: Protocol-oriented integers

Haravikk swift-evolution at haravikk.me
Sat Feb 25 04:57:52 CST 2017


> On 24 Feb 2017, at 02:05, Ben Cohen via swift-evolution <swift-evolution at swift.org> wrote:
> 
> Regarding the question of the trailing argument to distinguish overflow-checking vs expanding versions of multiplied: rather than add an enum or use the void trick in order to do this via arguments, it is better to just distinguish the two functions via different base names.

Regarding trailing arguments, any chance we could get you to weigh in on on the "Allow trailing argument labels" discussion?
Personally I like the idea of using the trailing arguments, but not having to use enums to do it; a proper language feature could make it more viable. One variation discussion could for example looking like:

	let result = a.adding(b):reportingOverflow

Think of the trailing "argument" as a kind of selector, telling Swift which specific version of the adding method you want to invoke. I prefer this to elongated method names, but maybe others wouldn't.

If there's appetite for that style though then it would make sense to implement the language feature first, rather than creating inconsistencies now.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20170225/ca721c59/attachment.html>


More information about the swift-evolution mailing list