https://kotlinlang.org logo
i

igorlukanin

03/25/2016, 3:48 AM
In Kotlin, there is a convention that if the last parameter to a function is a function, that parameter can be specified outside of the parentheses
Can’t we have the same behaviour for the last (and the only) parameter to a constructor? In some cases it may “unclutter” the code a little bit:
Copy code
open class A(func: A.() -> Unit)

class B: A({
    // Works
})

class C: A {
    // Doesn't work
}