Arne said:
I think we should agree here on cljp that this is the correct term
and push it to the rest of the world!
Lew said:
Or we could agree to use the term already defined in the JLS.
And that was?
JLS § 8.2 defines,
We use the phrase /the type of a member/ to denote:
- For a field, its type.
- For a method, an ordered 3-tuple consisting of:
o *argument types*: a list of the types of the arguments to the method member[;]
o *return type*: the return type of the method member[;] and the
o *throws clause*: exception types declared in the throws clause of the method member.
Additional information:
§ 13.1 of the JLS calls the whole shebang, "the erasure ... of the
qualifying type of the [method] invocation, plus the erasure of the
signature of the method." This applies to method invocations.
§ 15.12.3 tells us, "If the compile-time declaration for the method
invocation is not void, then the type of the method invocation
expression is the result type specified in the compile-time
declaration."
It was and still is.
If I understand Lew, he is noting that the the JLS uses the term
"type" for return type plus signature and recommending this. I don't
think this usage would be helpful in more generally.
His examples suggest that even in the JLS it's a bit iffy and
unclear. In the second example, we get that a
'type' [of method invocation] is a 'result type'
but that's clearly wrong if the first type is a type in this more
general
sense. An ordered tuple is not the same thing as one element of that
tuple.
Do method invocations not have 'type's in the more general sense? Or
given that this is a type of a method invocation expression -- rather
than of the method itself -- maybe the JLS should have said 'result
type' in both places, though the use of type for an invocation in the
first example suggests that invocations have such a "full" type as
well as methods themselves.
To me the JLS's use of "type" is very easy to confuse with "return
type". I would expect that the phrase
"the type of the method" or "the method type"
would be interpreted by the vast majority of readers as the return
type of the method unless the phrase "type" is defined near where it
is used. By contrast, I'd be far less likely to misapprehend the
phrase "full signature" though I might have to look it up. The phrase
"full type" might be a compromise, though in I suspect most Java
users would think it has something to do with generics.
Since this is a concept that goes well beyond Java, I don't think the
JLS's usage need be the last word, though it should certainly be
considered.
Regards,
Tom McGlynn