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

Bruno Berisso gojan.wan at gmail.com
Tue Dec 15 10:56:05 CST 2015


I also hit the *!=* vs *<>* dilema and conclude that we could continue
using the *!=* as "not equal".

It's true that it will not be as consistent as before but I think it's a
reasonable price to pay taking into account the issues with *!* as 'not'.


> Not that I necessarily think this proposal is a good idea. The given
> examples reek of being against unwrapping for some reason.
>
> Why not use `if let aBool = aBool where !aBool`? And `if let someValue =
> someValue where !(otherBoolValue && someValue > 0)`?
>

I think the issue is the complete different meanings of a symbol depending
only in where it appears in an expression. Adding that *!* character is
really easy to miss in an expression make it at last uncomfortable.

I agree that we are all really used to find *!* in logical expressions and
our brain is trained to translate it to NOT automatically but that doesn't
mean that it's good idea to keep it there.

For example in `if let aBool = aBool where !aBool`, let's suppose that we
know that `aBool` optional it's not empty before this check. How would you
write it? `!aBool!` or with the `if let...` ?

I think that clearly *!* is not good choice for negation but my mind is so
used to it that I can't totally affirm that *not* is *the* alternative to
it. Do we have another alternatives?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20151215/55b39120/attachment.html>


More information about the swift-evolution mailing list