I feel like I haven’t quite figured out the right ...
# exposed
d
I feel like I haven’t quite figured out the right tricks for using the boolean expression operators (
Expression<Boolean>.and
and friends) w.r.t. operator precedence. Do I just need to always parenthesize every sub-expression? I guess Kotlin doesn’t really do precedence levels of custom infix operators?
j
In the case of
columnA eq true and columnB eq false
I believe that
and
and
eq
have the same precedence because they are both method calls, so the compilter thinks you are trying to execute
(columnA eq true and columnB) eq false
which is obviously not correct.
The style presented int he docs is to use
columnA eq true and (columnB eq false)
meaning you should parenthesize everything but the first statement, but it can't hurt to also parenthesize the first statement if that looks good to you.
d
i guess infix ops are left associative which is why you don’t need the first one? yeah i’ve been doing that. intellij indentation for it isn’t beautiful though
j
Yep