Partial function application prematurely runs codeblock when used with underscore
问题 Given: def save(f: => Any)(run:Boolean) { if (run) { println("running f"); f } else println("not running f") } I can call it with: save("test")(true) -> running f save("test")(false) -> not running f save(throw new RuntimeException("boom!"))(false) -> not running f save(throw new RuntimeException("boom!"))(true) -> running f and then exception thrown Here's the curious behaviour with partial application: save(throw new RuntimeException("boom!"))(_) -> (Boolean) => Unit = <function1> //as