[swift-evolution] Remove (!) logical negation operator
Thorsten Seitz
tseitz42 at icloud.com
Wed Dec 16 00:19:19 CST 2015
It just occurred to me that there is one problem with replacing "!" with "not":
"not" would be the first operator being a word, which would lead down a slippery slope that I'd rather not tread: would we allow user defined unary operators being words?
I'd rather not as this makes expressions unreadable IMHO. That is a problem I have with Scala: there they often use words as operators which I find difficult to read.
Haskell does not have this problem as "not" is just a unary function there.
So, I'd like to keep the ! even though I'm no friend of it.
-Thorsten
> Am 15.12.2015 um 19:39 schrieb Al Skipp via swift-evolution <swift-evolution at swift.org>:
>
>> 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) { …
>
>
> _______________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org
> https://lists.swift.org/mailman/listinfo/swift-evolution
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20151216/4b1b8cc9/attachment.html>
More information about the swift-evolution
mailing list