Ruckus
08/08/2020, 9:08 PMinline fun <reified T: Application> launch() = Application.launch(T::class.java)
which can be used like launch<MyApp>()
. It would be pretty slick if you could instead do something like MyApp.lauch()
that would do the exact same thing.
This is a very minor thing with very little benefit over looks, but I figured I'd suggest it.
Before any one suggests it, no, companion objects won't solve the problem as this needs to be generic.jw
08/09/2020, 1:52 AMT.launch
solve this?jw
08/09/2020, 1:53 AMjw
08/09/2020, 1:53 AMKClass<T>
so it becomes MyApp::class.launch()
jw
08/09/2020, 1:53 AMKClass<T>
and T.Companion
don't refer to the same instance.Ruckus
08/09/2020, 1:56 AMHanno
08/09/2020, 7:30 AMRuckus
08/09/2020, 2:51 PMlouiscad
08/09/2020, 2:58 PMRuckus
08/09/2020, 2:59 PMlouiscad
08/09/2020, 3:00 PMraulraja
08/09/2020, 11:38 PM//given provider proofs Unit(truth) -> App, object, val and class also supported
@given fun app(): App = MyApp()
//given summons coherent provider in the classpath in any expression position not just contructors or args
fun MyApp.Companion.launch(app: App = given()) = app.reallyLaunch()
MyApp.launch() // runs with coherent provider app()
MyApp.launch(testApp) //runs with local override testApp
No reified types or inlining really required since this is solved in the type-checking phase in resolution and call sites get their values injected. While the original description of Keep 87 did not have implicits, Arrow Type Proofs have given coherent implicits, extension projections, coercion functions, union types and type refinements that are verified at compile time. Just waiting for 1.4 to stabilize to launch the first preview release and some more KEEPs for each of the features in case others in the lang are interested
I stopped discussing in the KEEP because it got a lot of traction but no official response and I get why, it became controversial at some point with so many design opinions and choices. I really don’t know how KEEPs are supposed to work.