Kotlin lets an instance use function-call syntax when its type defines an `operator fun invoke(...)` method. Writing `target(args)` is a concise call to `target.invoke(args)`. This is the same convention behind ordinary calls to lambdas and function-type variables, whose generated `FunctionN` interfaces define `invoke`. Use it when function-like syntax makes an API clearer; avoid it when the call would hide an unclear action. section 13.3.1 section 10.1.3
Make a custom object callable
```kotlin class Greeter(val greeting: String) { operator fun invoke(name: String) { println("$greeting, $name!") } } val greeter = Greeter("Servus") greeter("Dmitry") // calls greeter.invoke("Dmitry") ``` `invoke` may have any parameter list and return type, and a type may overload it. The `operator` modifier enables the parenthesized form; the explicit method call remains available. section 13.3.1
Function calls already use this mechanism. A lambda stored in a function type is an object implementing the matching `FunctionN` interface, so `f(42)` and `f.invoke(42)` execute the same body. The explicit form is particularly useful with nullable function types: `callback?.invoke()` safely calls the callback only when it is non-null. section 10.1.3 section 10.1.4
Use invoke for flexible DSL blocks
An `invoke` method can accept a lambda with receiver, allowing an API to offer both a direct call and a nested block. ```kotlin class DependencyHandler { fun implementation(coordinate: String) { /* add dependency */ } operator fun invoke(body: DependencyHandler.() -> Unit) { body() } } val dependencies = DependencyHandler() dependencies.implementation("group:artifact:version") dependencies { implementation("group:artifact:version") } ``` The second form is `dependencies.invoke({ ... })`. Calling `body()` supplies the handler as the lambda receiver, making `implementation` available without qualification. section 13.3.2
The convention also matters when invoking reflected functions. A specifically typed `KFunctionN` exposes `invoke` with its declared parameter types, so incorrect argument counts or types fail at compile time. By contrast, the generic `KCallable.call` accepts variable arguments and can fail at runtime. section 12.2.1

