The meaning of Select
and Apply
is purely syntactical.
Select(prefix, newTermName("member"))
means prefix.member
Apply(prefix, List(arg1, arg2, ...))
means prefix(arg1, arg2, ...)
So techically, Random.nextInt
is a Select
, but the Scala typechecker wrapped it in an additional Apply
because Random.nextInt
is defined as a function that takes single, empty parameter list. In other words, this is a desugaring performed by the typechecker.
This isn't the case with List
's head
method. If you look at its definition, it takes no parameter lists:
def head: A
And that's why the typechecker does not wrap it in an Apply
tree.
Summarizing - there is difference between methods that take single, empty parameter list and methods that take no parameter lists. As a syntactic sugar, Scala allows to call methods with single, empty parameter list as if they take no parameter lists (without any parens), but the typechecker will still add the Apply
in such cases.