Hacker News new | ask | show | jobs
by agrounds 889 days ago
Scala 2’s implicits have been a source of great pain in many Scala codebases at many different organizations. They are too powerful. The situation is comparable to languages that depend on gotos instead of structured control flow elements (for/while loops, if statements, function/subroutine calls).

I can’t speak for Scala 3 as I haven’t used it at all. If they’ve limited the power of implicits to a few more structures usages it would be a great benefit to the language.

2 comments

In Scala 3, implicits live on under a different name. They're called _given_s. But they're reduced to just one use case: propagating a context through (and deriving one given form others). And Type Classes are subsumed under this use case.

The other use cases have been essentially removed:

* Extension methods are now its own feature, relying on completely different mechanism * Automatic conversions have been severely curbed and de-emphasized, although they are still there, but much more explicit

Too powerful? Or just ab/mis-used?