|
|
|
|
|
by _a1_
1955 days ago
|
|
> Scala just has implicits which can be used for method extension. I don't think it's fair to say it like this. Scala's implicits can mean different things, depending on where they're used. Scala 3 even divides 'implicit' to multiple keywords. (kind of 'static' in C++ I guess, only more complicated) |
|
Scala has one feature (implicits) but it can be used ("mean") for different things.
Essentially, you can mark definitions as implicit and you can mark parameters as implicit. Yes, Scala 3 uses different keywords to make it easier to understand which is what, but both is still just the concept of things being implicit.
Think about it: one without the other is completely useless. If you cannot define implicit parameters, then marking any value as implicit will not have any effect. The other way around too: you can mark your parameters as implicit as much as you want, if you can't define implicit values, you will always be forced to pass all parameters manually.
Even implicit classes (excentions) are just syntactic sugar for regular methods that are marked implicit.