Comment by rhdunn
3 hours ago
I like a lot of Scala but dislike implicits. I feel like it is the wrong abstraction in that it is similar to implicit type conversion in C/C++, making it harder to reason about what the code is doing and navigating to the types/methods being called.
I prefer extension methods for what Scala implicits do [1], [2]. The only part that is lacking with extension methods is to be able to extend a type to implement an interface, e.g. Comparable, but you can create extension methods that return anonymous objects [3].
[1] https://kotlinlang.org/docs/extensions.html#anonymous-extens...
[2] https://learn.microsoft.com/en-us/dotnet/csharp/programming-...
[3] https://discuss.kotlinlang.org/t/extensions-function-to-impl...
No comments yet
Contribute on Hacker News ↗