Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #32789
| From | James Kuyper <jameskuyper@verizon.net> |
|---|---|
| Newsgroups | comp.lang.c, comp.lang.java.programmer |
| Subject | Re: Do function arguments invoke a function? |
| Date | 2015-10-04 14:36 -0400 |
| Organization | Self |
| Message-ID | <561171C7.5060700@verizon.net> (permalink) |
| References | <eaba057c-8bec-449a-8055-039f2c314655@googlegroups.com> <56115B07.6070102@verizon.net> <invocation-20151004180729@ram.dialup.fu-berlin.de> |
Cross-posted to 2 groups.
On 10/04/2015 01:19 PM, Stefan Ram wrote: > Newsgroups: comp.lang.c,comp.lang.java.programmer > > James Kuyper <jameskuyper@verizon.net> writes: >> On 10/04/2015 05:15 AM, Chad wrote: > >>> In Java, when a method is called, the methods arguments invoke the method. > ^^^^ thus the Newsgroups header! > >> Could you explain what that phrase "the method's arguments invoke the >> method" means to you? Knowing that, I might be able to answer with >> respect to C. As it stands, the phrase doesn't make sense to me. > > You are right! > > To »invoke« means to start, to execute, to run something. Arguments are > expressions that can be part of a method invocation expression. OK - it's just as true in C/C++ that the argument of a function can be the result of evaluating an expression. I hadn't thought of his question in those terms. In that sense, in C++ an argument expression can invoke methods associated with the objects involved in the expression, and can invoke methods associated with the same class that the calling method is associated with, even including another instance of the same method. However, they cannot be said, in any sense, to invoke the same instance of that method which they themselves are arguments of. It's the calling code that does that invocation, not the arguments. Evaluation of all method arguments must be complete, before evaluation of the method itself can start, so it's never the case that the arguments themselves invoke the instance of the method that they themselves are arguments to. Does Java have different rules in this regard that would make Chad's comment meaningful? > For example, in Java, the following is an expression: > > java.lang.Math.random() > > . This method invocation expression (JLS 15.12) has no arguments. > If the method's arguments would invoke the method, it would not > be invoked here, since there are no arguments. > > Moreover, a method does not have arguments in Java at all. It has > /parameters/. A /method invocation expression/ has arguments. That distinction applies to C/C++ as well.
Back to comp.lang.java.programmer | Previous | Next | Find similar | Unroll thread
Re: Do function arguments invoke a function? James Kuyper <jameskuyper@verizon.net> - 2015-10-04 14:36 -0400
csiph-web