[swift-evolution] Remove (!) logical negation operator

Al Skipp al_skipp at fastmail.fm
Tue Dec 15 12:39:53 CST 2015


> I cannot think of a language where I don’t have ! as negate (which I read as not).

There’s Haskell, a language well endowed with cryptic operators, but not prefix !, it uses a ‘not’ function instead.

You could do the same in Swift, should you wish:

func not(bool: Bool) -> Bool { return !bool }

And because in Swift, ‘if’ doesn’t require braces around the predicate, it doesn’t look too bad.
if not(x) { …

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20151215/40deda8b/attachment.html>


More information about the swift-evolution mailing list