Remove (!) logical negation operator


(Yichen Cao) #1

Instead, I prefer the force unwrap to be another character other than the negate operator. It makes no sense to have the negation operator be universal and suddenly introduce the force unwrap with the same character.

Yichen


Joining Old Orphaned Posts to the Main Threads
(Rafael Costa) #2

I think like Jeremy Pereira.

I also am quite surprised that the overloading of the meaning of symbols is

a serious issue. It’s natural for people to distinguish the meaning of
things by context. C programmers don’t complain that they are always
confusing pointer dereferencing with multiplication do they? No.

It is used for two meanings? Yes. Does it cause THAT much of confusion? No.
I really think the way we're going today is just fine. Just an opinion
though.

···

On Wed, Dec 16, 2015 at 1:28 PM Dennis Lysenko via swift-evolution < swift-evolution@swift.org> wrote:

Ilya, +1. I have seen maybe 3-4 force unwraps in a 20,000 lines-of-swift
codebase. There is no need for them in practice when you use optional
binding.

On Wed, Dec 16, 2015, 9:33 AM ilya via swift-evolution < > swift-evolution@swift.org> wrote:

Well the best way to make sure there is no confusion is to discourage the
usage of both operators.

Every time there's an expression that contains an excessive number of !s
it can be refactored by extracting separate variables, using non forced
unwrapping, comparing with true and false etc.

Not sure a syntactic change is warranted.

On Wed, Dec 16, 2015 at 17:04 Yichen Cao via swift-evolution < >> swift-evolution@swift.org> wrote:

Instead, I prefer the force unwrap to be another character other than
the negate operator. It makes no sense to have the negation operator be
universal and suddenly introduce the force unwrap with the same character.

Yichen

_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution

_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution

_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution


(ilya) #3

Well the best way to make sure there is no confusion is to discourage the
usage of both operators.

Every time there's an expression that contains an excessive number of !s it
can be refactored by extracting separate variables, using non forced
unwrapping, comparing with true and false etc.

Not sure a syntactic change is warranted.

···

On Wed, Dec 16, 2015 at 17:04 Yichen Cao via swift-evolution < swift-evolution@swift.org> wrote:

Instead, I prefer the force unwrap to be another character other than the
negate operator. It makes no sense to have the negation operator be
universal and suddenly introduce the force unwrap with the same character.

Yichen

_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution


(Marc Knaup) #4

If we use "~" for negation then we'd have to use "~=" and "~==" for
comparison which in turn conflicts with the pattern matching operator.

"?" and "!" for optionals and force unwrap are perfectly fine since the
former is for questions ("is it nil or is it not?") and the latter is an
exclamation mark usually used to draw attention ("yes I'm sure it is
non-nil / not throwing!").

···

On Wed, Dec 16, 2015 at 3:03 PM, Yichen Cao via swift-evolution < swift-evolution@swift.org> wrote:

Instead, I prefer the force unwrap to be another character other than the
negate operator. It makes no sense to have the negation operator be
universal and suddenly introduce the force unwrap with the same character.

Yichen

_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution


(Dennis Lysenko) #5

Ilya, +1. I have seen maybe 3-4 force unwraps in a 20,000 lines-of-swift
codebase. There is no need for them in practice when you use optional
binding.

···

On Wed, Dec 16, 2015, 9:33 AM ilya via swift-evolution < swift-evolution@swift.org> wrote:

Well the best way to make sure there is no confusion is to discourage the
usage of both operators.

Every time there's an expression that contains an excessive number of !s
it can be refactored by extracting separate variables, using non forced
unwrapping, comparing with true and false etc.

Not sure a syntactic change is warranted.

On Wed, Dec 16, 2015 at 17:04 Yichen Cao via swift-evolution < > swift-evolution@swift.org> wrote:

Instead, I prefer the force unwrap to be another character other than the
negate operator. It makes no sense to have the negation operator be
universal and suddenly introduce the force unwrap with the same character.

Yichen

_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution

_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution


(Andrew Bennett) #6

+1 Ilya, if one was to be removed I'd remove force unwrap (and implicitly
unwrapped optionals unless their type inference rules are fixed).

···

On Thursday, 17 December 2015, Rafael Costa via swift-evolution < swift-evolution@swift.org> wrote:

I think like Jeremy Pereira.

I also am quite surprised that the overloading of the meaning of symbols

is a serious issue. It’s natural for people to distinguish the meaning of
things by context. C programmers don’t complain that they are always
confusing pointer dereferencing with multiplication do they? No.

It is used for two meanings? Yes. Does it cause THAT much of confusion?
No. I really think the way we're going today is just fine. Just an opinion
though.

On Wed, Dec 16, 2015 at 1:28 PM Dennis Lysenko via swift-evolution < > swift-evolution@swift.org > <javascript:_e(%7B%7D,'cvml','swift-evolution@swift.org');>> wrote:

Ilya, +1. I have seen maybe 3-4 force unwraps in a 20,000 lines-of-swift
codebase. There is no need for them in practice when you use optional
binding.

On Wed, Dec 16, 2015, 9:33 AM ilya via swift-evolution < >> swift-evolution@swift.org >> <javascript:_e(%7B%7D,'cvml','swift-evolution@swift.org');>> wrote:

Well the best way to make sure there is no confusion is to discourage
the usage of both operators.

Every time there's an expression that contains an excessive number of !s
it can be refactored by extracting separate variables, using non forced
unwrapping, comparing with true and false etc.

Not sure a syntactic change is warranted.

On Wed, Dec 16, 2015 at 17:04 Yichen Cao via swift-evolution < >>> swift-evolution@swift.org >>> <javascript:_e(%7B%7D,'cvml','swift-evolution@swift.org');>> wrote:

Instead, I prefer the force unwrap to be another character other than
the negate operator. It makes no sense to have the negation operator be
universal and suddenly introduce the force unwrap with the same character.

Yichen

_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
<javascript:_e(%7B%7D,'cvml','swift-evolution@swift.org');>
https://lists.swift.org/mailman/listinfo/swift-evolution

_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
<javascript:_e(%7B%7D,'cvml','swift-evolution@swift.org');>
https://lists.swift.org/mailman/listinfo/swift-evolution

_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
<javascript:_e(%7B%7D,'cvml','swift-evolution@swift.org');>
https://lists.swift.org/mailman/listinfo/swift-evolution