For me, I would use an implicit class under the following scenarios:
- don't have access to the underlying type to be able to add the method I want.
- the method I want doesn't make sense in a "global" sense.
- i am splitting the functionality into another library of "extensions"
- actually converting to a new type adds semantic/readability value (the new type actually means something)
However, I am fairly new to Scala (<6 months) and I'm noticing the developers around me are using implicit classes when it breaks the scenarios above. When I asked why, the answer was "because that's what I've always done".
So my question is, is there an official recommendation for when one should use an implicit class over a normal function added to the class definition? (I couldn't find anything here: https://docs.scala-lang.org/overviews/core/implicit-classes.html)