5 ms·
The implicit keyword is extremely powerful when used appropriately and not something that should just be shunned completely. My favorite usage is probably in a
by harryh 7y ago
The implicit keyword is extremely powerful when used appropriately and not something that should just be shunned completely.
My favorite usage is probably in a typesafe Query engine that several people[1] built at Foursquare that is a lot better than what you can find in the java world.
Venue.where(_.closed eqs false)
.orderAsc(_.popularity)
.limit(10)
.modify(_.closed setTo true)
.updateMulti
It allows for all sorts of typesafe queries that will fail at compile time if things are malformed including stuff like failing to query on an index.
https://github.com/foursquare/rogue https://github.com/foursquare/rogue
1. Hi Jorge, Liszka & Neil!
- dangerlibrary 7y agoI've never shown a use of "implicit" to an experienced developer unfamiliar with Scala and seen them get excited about the language. The best case scenario is that they aren't instantly horrified / confused / repulsed.
- harryh 7y agoThere are a lot of tools in the world that are confusing at first but are extremely powerful and useful once you understand their use. implicit is one of them
- dangerlibrary 7y agoI never said it wasn't powerful.
- fiddlerwoaroof 7y agoThe one thing that I like about Scala is Spark which is a really good example of what something like implicits can enable
- sk5t 7y agoAutomatic capture of Manifest / type parameters might be the most immediately appealing thing to a Java person learning about Scala, I dunno. Maybe don't show them implicit conversion.