yole
09/16/2016, 12:30 PMpunksta
09/16/2016, 3:41 PMprotected abstract val <P> presenter: P where P : SomeClass
ean5533
09/16/2016, 3:48 PMclass Foo<P : SomeClass> {
val presenter: P
}
kevinmost
09/16/2016, 4:06 PMkevinmost
09/16/2016, 4:06 PMkevinmost
09/16/2016, 4:06 PMprotected abstract fun <P: SomeClass> presenter() : P
ean5533
09/16/2016, 4:07 PMzoltu
09/16/2016, 5:56 PMprotected abstract val presenter: SomeClass
?mbstavola
09/17/2016, 1:15 AMathor
09/17/2016, 2:19 AMsemoro
09/17/2016, 4:06 AMabstract class
? Interfaces can have only abstract properties, but delegation makes property implemented, which not allowed for interfaceskevinmost
09/17/2016, 4:28 AMvoddan
09/17/2016, 5:32 AMby
because it requires saving an instance of the class you delegate to in a private field, and interfaces do not have statevoddan
09/17/2016, 5:33 AMget
and set
manually in this casesvach
09/17/2016, 8:09 AMvach
09/17/2016, 8:09 AMScreen Shot 2016-09-17 at 16.07.05.png▾
vach
09/17/2016, 8:09 AMScreen Shot 2016-09-17 at 16.07.14.png▾
vach
09/17/2016, 8:10 AMvach
09/17/2016, 8:10 AMinternal class MinMaxOperator<T>(
vach
09/17/2016, 8:11 AMvach
09/17/2016, 8:15 AMcypher121
09/17/2016, 8:17 AM<T : Any>
. as it is, T is only bounded by Any?
and so could be either nullable or non-nullablevach
09/17/2016, 8:17 AMdimsuz
09/17/2016, 10:28 AMfun util(): Pair<Int,String> { ... }
val (foo, bar) = util()
and I do not need to use bar
, can I tell compiler I don't care about it? I tried val (foo, _)
, but it doesn't work.dimsuz
09/17/2016, 10:28 AMbar
is unused...voddan
09/17/2016, 10:33 AMsemoro
09/17/2016, 10:34 AMval foo = util().key
dimsuz
09/17/2016, 10:34 AMaaverin
09/17/2016, 1:58 PMorangy