https://kotlinlang.org logo
#announcements
Title
# announcements
f

Florian

07/11/2019, 9:15 PM
also, do
&&
and
||
not have an
operator fun
?
k

karelpeeters

07/11/2019, 9:19 PM
They shortcircuit and that wouldn't really translate well to an
operator fun
with standard arguments.
I suppose they could do something like
inline operator fun doubleAnd(left: Value, right: () -> Value)
but that's starting to get complicated 🙂
☝🏻 1
f

Florian

07/12/2019, 10:00 AM
ok I see
thanks
So this means not every operator is backed by an operator fun?
k

karelpeeters

07/12/2019, 10:46 AM
Sure.
f

Florian

07/12/2019, 9:03 PM
so what happens to these operators under the hood
the compiler just uses them directly?
k

karelpeeters

07/12/2019, 9:13 PM
and
,
or
and
xor
? Yeah, those get converted to the corresponding JVM bytecode without any function calls.
f

Florian

07/12/2019, 9:14 PM
I mean the shortcircuit ones
k

karelpeeters

07/12/2019, 9:15 PM
The compiler implements the logic for them internally yes, they're hardcoded somewhere.
f

Florian

07/12/2019, 9:16 PM
thanks alot
k

karelpeeters

07/12/2019, 9:16 PM
Haha
and
,
or
and
xor
that was the wrong thread my bad.
f

Florian

07/12/2019, 9:18 PM
but its interesting to know that they dont get called as functions either
2 Views