0
我認爲在Scala中調用方法時可能會失去偏見。我試圖做到這一點,但編譯器抱怨:在方法調用中留下圓括號
object Objd {
def m1(s: String) = {
StringBuilder.newBuilder
.append(s)
.toString()
}
def m2(s : Stirng) = {
StringBuilder.newBuilder
.append("Another string")
.append(";")
.append(m1 s) //compile error. Not applicable to String
.toString()
}
}
爲什麼在這種情況下不可能?