I have a case where I wish to extend a class that takes by-name parameter in it's constructor:
class Extension(something: Something)
extends Base(something.doSomething(something.getSomething(false))
class Base(expression: => Result) {
...
}
However, the call to something.getSomething(false)
causes side-effects, and so can't be called multiple times.
How can I store the result of something.getSomething(false)
, before passing it to the superclass' constructor?