In Kotlin, inlining is set with the inline keyword. However, it’s much more than just a compiler hint: it’s a requirement. Whenever inline is used, the compiler will inline the function, no matter what.

As such, it’s very important to use inlining only on small functions. Other limitations might include keeping its use to code under our control, e.g. to use it only for application code or code that is not part of a library’s public API.

Note that inlining affects both the function itself as well as arguments that are lambdas. To make lambda arguments not inlined, use the noinline keyword.

Infix notation is not automatic in Kotlin as it requires the function to be marked with the infix keyword. Additionally, the function needs to be attached to a class, either because it’s a member or an extension. Of course, the single parameter still applies.

// Defined in Kotlin's runtime infix fun and ( other : kotlin . Int ): kotlin . Int { /* compiled code */ } val bool1 = 1 . and ( 2 ) val bool2 = 1 and 2

Be aware that infix notation only looks similar to an operator, it’s still a regular method call underneath.