pakoito
08/25/2016, 2:36 PMpakoito
08/25/2016, 2:36 PMpakoito
08/25/2016, 2:40 PMpakoito
08/25/2016, 2:40 PMqwoodmansee
08/25/2016, 2:41 PMyole
08/25/2016, 2:43 PMqwoodmansee
08/25/2016, 2:44 PMyole
08/25/2016, 2:46 PMdata class Foo(private var _s: String = "default") {
var s: String?
get() = _s
set(value) {
_s = value ?: "default"
}
}
qwoodmansee
08/25/2016, 2:48 PMyole
08/25/2016, 2:48 PMyole
08/25/2016, 2:48 PMqwoodmansee
08/25/2016, 2:48 PMmichaelrocks
08/25/2016, 3:01 PMyole
08/25/2016, 3:03 PMthis
in a constructoryole
08/25/2016, 3:04 PMthis
in a super constructor parameter list. this is a JVM restriction, there is nothing we could do to change thismichaelrocks
08/25/2016, 3:05 PMinterface Test {
fun doSomething(): Unit
fun onDoSomething(): Unit
}
class TestMixin : Test {
override fun doSomething(): Unit {
onDoSomething()
}
override fun onDoSomething() = Unit
}
class TestImpl : Test by TestMixin() {
override fun onDoSomething(): Unit {
/* Impossible to call this method from TestMixin() */
}
}
michaelrocks
08/25/2016, 3:05 PMyole
08/25/2016, 3:05 PMby TestMixin()
is not a super constructor parameter listyole
08/25/2016, 3:06 PMthis
there; there is no fundamental reason why it can’t be allowedmichaelrocks
08/25/2016, 3:06 PMTestImpl@this
to `TestMixin`’s constructor?yole
08/25/2016, 3:07 PMmichaelrocks
08/25/2016, 3:07 PMmichaelrocks
08/25/2016, 3:07 PMyole
08/25/2016, 3:09 PMthis
to any other method that you call from a constructor, or calling a non-final method from a constructormichaelrocks
08/25/2016, 3:11 PMmichaelrocks
08/25/2016, 3:11 PMyole
08/25/2016, 3:11 PMkirillrakhman
08/25/2016, 3:11 PMmichaelrocks
08/25/2016, 3:12 PMredenergy
08/25/2016, 3:13 PM