Dotty: implicit(ly) versus given/summon

I get that. Which is the original reasoning behind choosing only one keyword.

However give x: X (given y: Y) makes it visually much easier to parse what means what, especially when working with real code that is usually longer and more complex. I am not saying this is the best solution. However I think using the same keyword is still more confusing than using two, even if it is semantically correct.

I think this problem is disregarded a little bit too easily.

Edit: to expand on the previous. In the original motivation behind changing implicits (Principles for Implicits in Scala 3) it questions why implicits are not the run-away success as in Rust or Haskell. For me, one of these reasons is clearly because type classes make a clear distinction between providing a one and requiring one.

Compare using one in Haskell versus Scala:

class (Eq a) => Ord a where ... and given ord: Ord[A](given eq: Eq[A]) = ...

5 Likes