raulraja
06/04/2019, 9:27 PMbloder
06/04/2019, 11:04 PMRepository
, can I from another module create something like:
fun login(password: String, with repo: Repository<Login>) {
loginWith(password)
}
bloder
06/04/2019, 11:06 PMSubpackes
on this text and I understand the problem about it but I think it's important we have a solution for that. For example the compiler looks for the extension by the import.raulraja
06/05/2019, 7:51 AMinternal
so you can use them in your apps just fine but they can't be consumed from external packages.raulraja
06/05/2019, 7:52 AMnfrankel
06/05/2019, 10:22 AMimplicit
keyword
the process of the compiler implicitly searching in different locations for the equality is a step in this (wrong for me) directionnfrankel
06/05/2019, 10:22 AMnfrankel
06/05/2019, 10:23 AMraulraja
06/05/2019, 5:23 PMnfrankel
06/06/2019, 6:37 PM[implicit] is liked by most developerson the other hand, spring fu shows the trend is to migrate to explicitness my point still stands
that is easy to understand where things are coming fromjust no it’s not because you know that it’s easy
bloder
06/06/2019, 6:51 PMnfrankel
06/06/2019, 7:56 PMyou also can click on your typeclass and see where it’s been createdperhaps... but then i misread the initial article because i understood differently
raulraja
06/06/2019, 8:05 PMraulraja
06/06/2019, 8:18 PMfun <A> A.foo() = TODO()
scala
implicit class FooSyntax[A](a: A) {
def foo(): Unit = ???
}
Kotlin simplifies the boilerplate in the user side compared to Scala 2.12 (in Scala 3 is the same as in Kotlin) but the argument and the receiver is still implicit since it’s provided in the call site without explicitly being passed by the user as a function argument.
KEEP-87 proposes the same as extension functions but you can then name a group of extensions. Once you have a name you can add that name as a constrain to activate the syntax a la carte where you need it. And that in fact is implicit argument injection same as in any DI framework despite people hating and being confused by scala implicits. Scala implicits are overkill IMO and have been abused and that is why they are getting rid of them in Scala 3 in favor of idioms that do the same thing but are use case specific. Swift, Scala and pretty much all moderns languages support a form of composition that is not through inheritance.
@nfrankel your case against autowiring does not apply to the KEEP-87 proposal because type classes as proposed are coherent and orphan overrides if permitted are internal and can’t be exported outside of the module for compiler resolution.raulraja
06/06/2019, 8:19 PMraulraja
06/06/2019, 8:19 PMraulraja
06/06/2019, 8:21 PMbloder
06/06/2019, 8:22 PMraulraja
06/06/2019, 8:23 PMraulraja
06/06/2019, 8:25 PM