Why does doSmth(() => s)
not compile?
Why does the rest of the code output "value"? Is there a way to call the second function(with call-by-name parameter)?
object Test {
def main (args: Array[String]){
lazy val s: String = ""
doSmth(s)
doSmth("")
doSmth(() => s)
}
def doSmth(p: String): Unit = {
println("value!")
}
def doSmth(p: => String): Unit = {
println("call by name!")
}
}