スコープ内の次の項目を想像してみましょう。
object Thing {
var data: Box[String] = Empty
}
def perform[T](setter: Box[T] => Unit) {
// doesn't matter
}
以下はコンパイルに失敗します:
perform(Thing.data = _)
エラーメッセージは次のとおりです。
<console>:12: error: missing parameter type for expanded function ((x$1) => Thing.data = x$1)
perform(Thing.data = _)
^
<console>:12: warning: a type was inferred to be `Any`; this may indicate a programming error.
perform(Thing.data = _)
^
以下がコンパイルされている間:
perform(Thing.data_=)
それ以来、より良い抽象化を作成することでこの問題を克服しましたが、私の好奇心はまだ残っています。
誰かがこれがなぜであるか説明できますか?