So why did the Scala team introduce givens and usings? How does that improve the implicits situation? The given resolution order is the same as before and now it seems like these are just new keywords for the an old concept. It's basically putting old wine in new bottles.
I think the reason is the name implicit was confusing because: - The name does not imply what it does - the implicit keyword is used for different things that are completely seperate from each other. The new keyword names adress these 2 things. I guess it's like a refactoring of the language: Same functionality but more comprehensible syntax.
Givens are not aliases of implicits. They have a different mechanism, it's only how the compiler looks for such values that's the same (so they can work interchangeably). The goal of using/given was indeed to constrain the power of implicits, because they were often misused.
Amazing how you make these implicitly abstract scala concepts looks explicitly concrete.
Just enjoy your way of simplifying things.
So why did the Scala team introduce givens and usings? How does that improve the implicits situation? The given resolution order is the same as before and now it seems like these are just new keywords for the an old concept. It's basically putting old wine in new bottles.
Implicit keyword becomes deprecated. Scala 3.0 is still backwards compatible but later implicit will be removed.
I think the reason is the name implicit was confusing because:
- The name does not imply what it does
- the implicit keyword is used for different things that are completely seperate from each other.
The new keyword names adress these 2 things. I guess it's like a refactoring of the language: Same functionality but more comprehensible syntax.
tldr: givens+using are interchangable with implicit
Pretty much - with a bit of background about how the compiler works with them
Like, then watching :)
Are there differences between given and implícits, or are they just an alias of each other?
I too am wondering this. Are there compiler optimizations or some other benefit to using/given besides constraining the application of implicits?
Givens are not aliases of implicits. They have a different mechanism, it's only how the compiler looks for such values that's the same (so they can work interchangeably). The goal of using/given was indeed to constrain the power of implicits, because they were often misused.
Nice!!!:)
Glad you liked it!