Paulius Ruminas
06/04/2019, 6:29 PMfunction foo<T extends Bar>() {}
and class Foo<T extends Bar> {}
. Just out of curiosity were there any limitations why it couldn't be like fun foo<T : Bar>() {}
in Kotlin?Ruckus
06/04/2019, 6:32 PMfun <T : Bar> foo<T>() {}
isn't valid Kotlin. Did you mean:
fun <T : Bar> foo() {}
Paulius Ruminas
06/04/2019, 6:32 PMclass Foo<T : Bar>
so I'm wondering why functions do not follow the same convention.Ruckus
06/04/2019, 6:34 PMPaulius Ruminas
06/04/2019, 6:39 PMRuckus
06/04/2019, 6:46 PMPaulius Ruminas
06/04/2019, 6:47 PMRuckus
06/04/2019, 6:48 PMDico
06/04/2019, 11:43 PMkarelpeeters
06/05/2019, 11:45 AMfun T.foo<T>()
is weird. The same reason works for Java with the return type: public T foo<T>()
would be weird.Paulius Ruminas
06/05/2019, 12:23 PMI think the explanation was the receiver type:probably this is why they chose the current syntax.is weird.fun T.foo<T>()