Scala Implicits Debate
The cluster centers on discussions about Scala's implicits, including implicit parameters and conversions, debating their power, readability issues, comparisons to other languages like Kotlin and C#, and overall merits versus drawbacks.
Activity Over Time
Top Contributors
Keywords
Sample Comments
What Kotlin features do implicits serve to replace? I'm new to Scala and am having trouble imagining when I'd want to use an implicit, so I'm genuinely curious.
What's wrong with implicits?
Scala's "implicit" keyword seems a famously contentious example of code obfuscating trickery
What's the problem of implicit arguments in scala? I can see why implicit conversions can be a problem but aren't implicit arguments required for typeclasses and other nice features?
I'm a programming language design geek... Out of curiosity, could you explain some of the ways you've been bitten by implicits?
Implicits are tricky, but they are the best way I know of to solve the problems they do. Other languages (JavaScript, Swift, etc.) have essentially open classes, where attachment of additional functionality to a type impacts a program globally. Implicits make it much easier to scope these extensions.They are also quite useful for wiring up context (take Akka's ActorSystem, for example) at the declaration level, so that the bodies of your classes and functions only explicitly talk about y
Implicits are very powerful when used correctly, but are terrible if not.
It's called implicits in Scala
Apart from it's not all accurate. Implicits have been part of Scala from the start and are used heavily throughout all the core libraries and many large projects so they will not be going anywhere... the changes in 2.10 allow you to use implicit classes on top of the current uses (and using implicit parameters is considered good practice), though they generate a compile time warning if you don't import implicitConversions.
Implicit Conversion is indeed powerfull. But so is the goto statement. My experience with implicit conversion is: "Lets read this code, Ah i think it does X. Let's run it, wait what is happening, ow my why is this implicits here?"You could argue that you should use them with care, but i'd argue not to include them in the language. You'll go c++ all the way.Implicits are very powerfull for creating DSL's in Scala. And indeed scala is a good language for doing D