Java-style anonymous callbacks include relatively much boilerplate and are not pleasing to read. It would be nice to have something like
workExpression
instead of
new SomeIF {
@Override public someType doRun() {
return workExpression
}
}
What are the possible solutions?
A possible solution is using
implicitdefs for converting functions to the legacy callback types. For example:Therefore when working with some code, one could create a helper trait for the common callback types used in that code to ease readability.