|
|
|
|
|
by tastyminerals2
2051 days ago
|
|
There is no straighforward elegant way of doing "obj.scalaMethod.myCustomMethod.scalaMethod.myCustomMethod" in Scala. I want to create a method and just inject it into the chain, no fiddling or ducktaping or using some black Scala magic. "def myFun(a: String, b: Double): Boolean = {...}"
and then "obj.mapValues.myFun.forall(_)" or just anything similar. And yes, Scala is exactly the language when you need safe and maintainable code with far less unit tests required than in Java. But you have to invest into it and sometimes it is simply not worth it. The Scala2 to Scala3 migration situation makes things even worse unfortunately. |
|
And it will be even easier in Scala 3, where this pattern is coded into an even simpler feature: extensions.