would it be accurate to say that `if` is a top-lev...
# announcements
l
would it be accurate to say that
if
is a top-level function with the following signature?
Copy code
fun if(condition: Boolean, action: () -> Unit)
d
If the symbol weren't reserved and this compiled, there would be a lot of similarities, but it would probably return an object with an infix function
else
and a type parameter for the inferred return type of the lambda so it can be used as an expression
s
And it would have the keyword
inline
and the
action
would be a
suspend
lambda.
k
Action wouldn't be
suspend
https://pl.kotl.in/O3_NYNaW3 I did on my phone so don't be harsh. If your function is inlined you can call suspending functions if you are in a suspendable context
s
Correct, forgot about that. Inlined lambdas don't need the suspend keyword.