I’d like to point out that this is specifically within the context of the type of project that @lihaoyi works on, and isn’t necessarily representative of the type of projects that everyone works on. I pointed this out on the original thread, which is quoted below for convenience:
Occasionally you need to define-and-import orphan implicits when you need a
T[V]
and bothT
andV
are from external libraries, but those are uncommon cases and not something that you do “by default”I think this is more common than you believe. Besides the canonical library of these for Cats and the Standard Library (alleycats ), a trivial search brings up three independent projects providing this for Cats and Scalacheck. There are also additional projects along these lines for Cats & Scalatest, and equivalent projects if you replace “Cats” with “Scalaz” in the preceding examples.
That’s aside from the internal libraries designed to correct ergonomic issues with Scalatest, Scalacheck, Mockito, Anorm, and etc that I currently help maintain in my day job, which depend heavily on implicits to make them usable. Better discoverability and error messages would be very helpful, as currently we rely on an import convention similar to cats.
Making define-and-import more difficult would greatly increase the adoption barriers of these libraries, and removing this capability altogether would put us right back into the space of relying on the library designers to anticipate every use case. Based on the number of libraries providing this functionality, there’s clearly an unmet need which the library designers aren’t able to fulfill.
Some of them are great about trying to provide as many of these instances as possible (shout out to enumeratum, who do an exceptional job of this), but others wouldn’t be able to keep up (scalacheck is a good example of an excellent library with a dearth of maintainers). Regardless, given the number of possible connections between libraries, I don’t think it’s reasonable to put this burden on them in the first place.