Questions tagged [call]

Do not use this ambiguous tag. For the action of invoking a subroutine of code, an external program or a script, use the tag [method-call]. For the topic of making phone calls, use the tag [phone-call].

In programming, a call is the site of invocation of a subroutine of code which when completed will return execution to the next instruction following the invocation of the call. A call is distinct from a jump in that there is no expectation of return after a jump.

A call may also invoke an external program.

This tag should also be used for language or platform specific functions for making a call. Some examples are:

  • call() - VBA
  • exec() - PHP
  • system() - C, Ruby

Related Topics

For other topics related to "calling", please use a more specific tag:

  • - For making and managing real-time two-way voice communication
4305 questions
367
votes
18 answers

When is the finalize() method called in Java?

I need to know when the finalize() method is called in the JVM. I created a test class which writes into a file when the finalize() method is called by overriding it. It is not executed. Can anybody tell me the reason why it is not executing?
Rajesh Kumar J
  • 4,745
  • 6
  • 26
  • 25
363
votes
12 answers

Passing an array as a function parameter in JavaScript

I'd like to call a function using an array as parameters: const x = ['p0', 'p1', 'p2']; call_me(x[0], x[1], x[2]); // I don't like it function call_me (param0, param1, param2 ) { // ... } Is there a better way of passing the contents of x into…
Robert
  • 4,324
  • 2
  • 18
  • 22
353
votes
19 answers

Getting output of system() calls in Ruby

If I call a command using Kernel#system in Ruby, how do I get its output? system("ls")
Macha
  • 14,366
  • 14
  • 57
  • 69
248
votes
9 answers

Explanation of [].slice.call in javascript?

I stumbled onto this neat shortcut for converting a DOM NodeList into a regular array, but I must admit, I don't completely understand how it works: [].slice.call(document.querySelectorAll('a'), 0) So it starts with an empty array [], then slice is…
Yansky
  • 4,580
  • 8
  • 29
  • 24
177
votes
16 answers

Python __call__ special method practical example

I know that __call__ method in a class is triggered when the instance of a class is called. However, I have no idea when I can use this special method, because one can simply create a new method and perform the same operation done in __call__ method…
mohi666
  • 6,842
  • 9
  • 45
  • 51
161
votes
7 answers

Running bash script from within python

I have a problem with the following code: callBash.py: import subprocess print "start" subprocess.call("sleep.sh") print "end" sleep.sh: sleep 10 I want the "end" to be printed after 10s. (I know that this is a dumb example, I could simply sleep…
user1638145
  • 1,979
  • 2
  • 14
  • 14
119
votes
10 answers

Calling a function within a Class method?

I have been trying to figure out how to go about doing this but I am not quite sure how. Here is an example of what I am trying to do: class test { public newTest(){ function bigTest(){ //Big Test Here } …
WAC0020
  • 1,199
  • 2
  • 8
  • 3
95
votes
6 answers

How to pass a callback as a parameter into another function

I'm new to ajax and callback functions, please forgive me if i get the concepts all wrong. Problem: Could i send a callbackfunction as a parameter to another function that will execute the callback? function firstFunction(){ //some code //a…
Wee Kiat
  • 1,208
  • 1
  • 10
  • 12
90
votes
7 answers

How can I call a javascript constructor using call or apply?

How could I generalise the function below to take N arguments? (Using call or apply?) Is there a programmatic way to apply arguments to 'new'? I don't want the constructor to be treated like a plain function. /** * This higher level function takes…
fadedbee
  • 42,671
  • 44
  • 178
  • 308
88
votes
12 answers

java how expensive is a method call

I'm a beginner and I've always read that it's bad to repeat code. However, it seems that in order to not do so, you would have to have extra method calls usually. Let's say I have the following class public class BinarySearchTree
jhlu87
  • 3,999
  • 8
  • 38
  • 48
86
votes
4 answers

To "Call" or "Not to Call" a batch file?

If from inside a bat file you called another batch file but still had a few remaining operations to complete, how can you make sure that the call to first bat file will after completion or error, will return to the file that called it in the first…
AltF4_
  • 2,312
  • 5
  • 36
  • 56
83
votes
3 answers

Javascript inheritance: call super-constructor or use prototype chain?

Quite recently I read about JavaScript call usage in MDC https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Function/call one linke of the example shown below, I still don't understand. Why are they using inheritance here like this…
Jeremy S.
  • 6,423
  • 13
  • 48
  • 67
76
votes
1 answer

Call a Subroutine from a different Module in VBA

Is it possible to call a function from one Module to another? I have the following code: Sub MAIN() Call IDLE End Sub MAIN is located in Module1 IDLE is located in Module2 and defined as: Sub IDLE()
Nimrod
  • 2,343
  • 3
  • 17
  • 7
73
votes
1 answer

How to make method call another one in classes?

Now I have two classes allmethods.cs and caller.cs. I have some methods in class allmethods.cs. I want to write code in caller.cs in order to call a certain method in the allmethods class. Example on code: public class allmethods public static void…
Mina Hafzalla
  • 2,681
  • 9
  • 30
  • 44
72
votes
3 answers

Passing variables, creating instances, self, The mechanics and usage of classes: need explanation

I just rewrote a working program into functions in a class and everything messed up. First, in the __init__ section of the class I declared a bunch of variables with self.variable=something. Should I be able to access/modify these variables in every…
Baf
  • 2,041
  • 3
  • 16
  • 10
1
2 3
99 100