Take the 2-minute tour ×
English Language & Usage Stack Exchange is a question and answer site for linguists, etymologists, and serious English language enthusiasts. It's 100% free, no registration required.

Particularly in computer science and informatics, when should one use them? Is call the preferred form?

For instance,

call function

invoke method

Googling for "call operation" returns +300 000 returns, whereas, "invoke operation" about +100 000.

EDIT: For further context, the doubt came to my mind when working with Cucumber's Gherkin language

"a Business Readable, Domain Specific Language that lets you describe software’s behaviour without detailing how that behaviour is implemented."

Eg:

Given some precondition
And some other precondition
When some action by the actor
And some other action
And yet another action
Then some testable outcome is achieved
share|improve this question

2 Answers 2

up vote 4 down vote accepted

The documentation for the Perl programming language[1] makes a conscious effort to use invoke when referring to method execution, because one always invokes methods on an invocant (/ˈɪnvɵkənt/ as a noun, not /ɪnˈvoʊkənt/ as an adjective).

The invocant is either a class or object used to identify the namespace where that named method is locate. SomeClass‑>new() and $obj‑>methname() both have invocants as the lefthand operand of the ‑> operator, respectively a class and an object. In languages like Java or Perl6 that use . for ‑>, it’s still the same thing: you still have a class or an object serving as the invocant.

In contrast, a simple function call or subroutine call has no such special invocant associated with its execution. Calling new() or funcname() hasn’t any extra thingie participating in the dispatch. Method invocation is just a special way of making a subroutine call, employing a bit of extra syntax and enjoying a bit of extra semantics.

But we try to not get to be too anal about it. Sometimes you’ll catch us saying method call, too. No big deal. Only languages like Java get anal about these things, refusing to admit that function calls even exist, creating the whole static method notion (which has no invocant) for want a normal function calls in the language.

[1] http://perldoc.perl.org/

share|improve this answer
    
This is an interesting twist. Why is the thing on which a method is invoked is an invocant? What is an invocant for that matter? Obviously because it is invoked. If it were call ed, it would been the called method. Forward logic is better. –  Kris Feb 24 '12 at 15:07
    
@Kris I recently wrote that “…the invocant is whatever the method was invoked with. Some OO literature calls this the method’s agent or its actor. Grammatically, the invocant is neither the subject of the action nor the receiver of that action. It’s more like an indirect object, the beneficiary on whose behalf the action is performed—just like the word “me” in the command, “Forge me a sword!” Semantically, you can think of the invocant as either an invoker or an invokee, whichever fits better into your mental apparatus.” –  tchrist Feb 24 '12 at 16:24

They mean the same thing, and "call" is shorter, so in general I suggest you use that.

share|improve this answer
    
No, they do not actually mean the same thing. –  tchrist Feb 24 '12 at 14:35
2  
I understand the distinction in your answer above, but I think the words are rarely used in the way you suggest. I would use the "method" word for something called via a class or object, and "function" (or, for clarity, "standalone function") for something called directly. I would happily use the verb "call" or "invoke" in either case. The distinction should be made with nouns, not verbs. The phrase "method call" is in the Google English corpus: books.google.com/ngrams/… –  Concrete Gannet May 23 '12 at 3:32
    
@ConcreteGannet You're right, they're the same in general, but technically they are different. It's like saying that a Robot and Cyborg are the same thing. –  Khaled A Khunaifer Mar 9 at 8:50
2  
OK, I'll put it another way. The distinction is so arcane that it is dangerous to use it. There is a danger your reader won't understand you. @tchrist, can you show any example of this distinction outside perl? I can show you counterexamples: The Java EE's javax.xml.rpc.Call and Apache Axis org.apache.axis.client.Call interfaces both define an invoke method. By your reasoning, the name of the interfaces are incorrect. Obviously the designers of these interfaces didn't think your way. I repeat what I said: if the distinction is important, use nouns ("function" vs "method"), not verbs. –  Concrete Gannet Mar 20 at 0:34
    
The phrase "method call" occurs more often than "method invocation" in the Google English corpus: books.google.com/ngrams/… –  Concrete Gannet Mar 20 at 0:35

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.