Created
March 28, 2012 06:12
-
-
Save yoshiori/2224153 to your computer and use it in GitHub Desktop.
括弧省略
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
object Main { | |
def main(args: Array[String]){ | |
Main puts "Main" | |
this puts "this" | |
// puts "foo" これがダメなのなんで??? | |
} | |
def puts(text:String){ | |
println(text) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
puts "foo" の、putsは、中置演算子でない(obj op param形式に従っていない)ので、演算子とみなされません。Scalaでは、レシーバが無いメソッド呼び出しで引数が一つ以上ある場合、括弧が省略できないので、puts "foo"は無理ということになります。