https://kotlinlang.org logo
#compiler
Title
# compiler
e

Eugen Martynov

11/11/2023, 11:13 AM
I would expect .not() and ! to have the same experience, but it looks like they are not. We got an internal discussion that there is not type casting with
not
and it doesn’t lead to
short circuit in a boolean evaluation
. The last one is probably expected since it has only sense for boolean type and you can have not operator for other types.
k

Kroppeb

11/12/2023, 5:18 PM
How can you short circuit 'not'?
e

Eugen Martynov

11/12/2023, 9:00 PM
Yeah, there was
not
involved in the boolean expression with
or
operator
k

Kroppeb

11/13/2023, 8:18 AM
?
e

Eugen Martynov

11/13/2023, 8:20 AM
Ah my bad
The first condition is false
so it works as expected 🙂
k

Kroppeb

11/13/2023, 8:22 AM
yep, when it's true, the second part doesn't run 🙂