[swift-evolution] Beyond Typewriter-Styled Code in Swift, Adoption of Symbols

Brent Royal-Gordon brent at architechies.com
Fri Sep 1 22:50:07 CDT 2017


> On Aug 31, 2017, at 5:51 PM, André “Zephyz” Videla <andre.videla at gmail.com> wrote:
> 
> That is exactly what I argue should be avoided. When you see `+` you don’t expect it to throw.


Perhaps not, but the language makes you mark the expression with `try` to make that fact clear. And your specific suggestion of `+!` is misleading—`!` usually implies  something that can fail *by asserting*, which plain `+` actually *does* but a throwing `+` does not.

In my view, an operator is just a funny-looking name. `+`, without any further context, does not imply an exact semantic with properties like commutativity any more than `add(_:)` does. I don't think anyone working on Swift seriously believes that every method name ought to be exclusively associated with one and only one protocol, so I see no reason that every operator ought to be, either.

Protocols describe precise, formal semantics; operators describe general kinds of operations. Let protocols be protocols and operators be operators.

-- 
Brent Royal-Gordon
Architechies

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20170901/9266faa4/attachment.html>


More information about the swift-evolution mailing list