Re: terminology
markspace <-@.> writes:
On 4/19/2012 5:17 PM, Lew wrote:
Stefan Ram wrote:
java.lang.Thread . dumpStack() java.lang.System.out . print( 2 )
I do call the source code part in front of the last dot a
/context/.
Fully-qualified type name.
I'd have said the same off the top of my head. I'd also call it a
"class" if FQN was a bit long, or I was being less strict in my speaking.
A ?type name? is a special kind of context, it is a static context.
My usage does not come from the JLS, but from javac who says things like:
Main.java:7: error: non-static method length() cannot be referenced from a static context
String.length();
^
1 error
When you teach java, explaining vocabulary of javac can't be
that wrong, even if it's not as authoritative as the JLS.
Obviously, the ?static context? above is ?String?.
I cannot call this ?type name?, since the part in front of
the last dot is not always a type name, as in
java.lang.System.out . println()
. ?java.lang.System.out? is the context of ?println()?
(in my terms), but it is not a type name.
I already gave this example in my OP, but it got lost
somewhere. The javac compiler seems to call this a
non-static context (by analogy from the above message).
I do call the simple name between the last dot and the first
parentheses a /verb/. (So a verb does never contain a dot.)
Simple method name.
<http://docs.oracle.com/javase/specs/jls/se7/html/jls-6.html#jls-6.5.7.1>
"Method" or "method invocation" works for me.
Obviously, these are all different things: A method is not
a method name, and a method is not a method invocation.
Some, albeit slight, justification of my term ?verb? comes
from the JLS 7, which says in 6.1:
"Method names should be verbs".