S
Stefan Ram
I wonder what the correct wording for the following situation is:
void print( final java.lang.Object object )
{ java.lang.System.out.println( object.toString() ); }
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
Without further thinking, one might say »The method
"toString()" is being called here.«.
However, according to the JLS, a methode is a specific member
of a specifc class. »toString« above does not denotate such an
entity, because for each invocation the method activated will
be determined only at run-time.
»toString()« yields a signature which is used at run-time to
choose a method. Sometimes (in the case of other identifiers
than »toString«) a method might not even be found in the
target object's class, so actually this is at most a »call
attempt«.
To call this »to call a method« might be misleading, because
it hides the indirection via late-binding and gives the wrong
impression that »toString()« indicates a specific method of a
specific class, while it really is only used to choose a
method at run time.
So, is there a more appropriate and precise wording?
The first two ideas that come to my mind would be to say »to
call a signature« or »to call an identifier«.
I believe that the last idea is better, because »identifier«
is used in the JLS3's description of the syntax of this
invocation pattern and it also takes into consideration that
the identifier expresses the intention of the author, while
there might be multiple possible signatures depending on minor
details for an identifier (like in »print("a")« and »print(2)«).
But »to call an identifier« is unusual and also not contained
in the usual sense of the verb to »call«. The second problem
might be addressed by using »to call /via/ an identifier«,
which also hints at the indirection.
void print( final java.lang.Object object )
{ java.lang.System.out.println( object.toString() ); }
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
Without further thinking, one might say »The method
"toString()" is being called here.«.
However, according to the JLS, a methode is a specific member
of a specifc class. »toString« above does not denotate such an
entity, because for each invocation the method activated will
be determined only at run-time.
»toString()« yields a signature which is used at run-time to
choose a method. Sometimes (in the case of other identifiers
than »toString«) a method might not even be found in the
target object's class, so actually this is at most a »call
attempt«.
To call this »to call a method« might be misleading, because
it hides the indirection via late-binding and gives the wrong
impression that »toString()« indicates a specific method of a
specific class, while it really is only used to choose a
method at run time.
So, is there a more appropriate and precise wording?
The first two ideas that come to my mind would be to say »to
call a signature« or »to call an identifier«.
I believe that the last idea is better, because »identifier«
is used in the JLS3's description of the syntax of this
invocation pattern and it also takes into consideration that
the identifier expresses the intention of the author, while
there might be multiple possible signatures depending on minor
details for an identifier (like in »print("a")« and »print(2)«).
But »to call an identifier« is unusual and also not contained
in the usual sense of the verb to »call«. The second problem
might be addressed by using »to call /via/ an identifier«,
which also hints at the indirection.