2

I know what a function call is. I know what it does. I've debugged it a lot. I do have some intuitive sense on why it makes sense to use the term "function call", but when it comes down to it, I can't explain this properly like I could with a return statement.

For example, with a return statement the answer is: it's called a "return" because you return to where you came from. You return to the line from where the function was called. So it makes sense why the end of a function (implicitly or explicitly) returns.

I've noticed that for people who speak English as their native language this easier to grasp (especially with more obscure words such as "cache"). However, for people like me (Dutch, learned English through videogames and subtitled television), it's harder to grasp.

I googled for this question, but I get all kinds of entries what a function call is and how it works. I associate the word "call" a lot with telephones, since that's what I use it mainly for in English.

I asked a similar question on what the "de-" means in the word "dereference" here: What does the de- prefix in dereference mean? Is there a linguistic explanation for it?

Community
  • 1
  • 1
Melvin Roest
  • 1,392
  • 1
  • 15
  • 31
  • 1
    Cross-site sort-of duplicate, but not entirely: https://softwareengineering.stackexchange.com/questions/253694/where-did-the-notion-of-calling-a-function-come-from –  Jan 14 '17 at 10:16
  • 1
    In assembly terms, you *jump* to a subroutine if you want to simply take the flow of the program there. You *call* a subroutine to imply that this change is temporary and that you intend the flow to return to you. – Theodoros Chatzigiannakis Jan 14 '17 at 10:16
  • 1
    Why the downvote? I explained what I did, how I couldn't find it and what I already knew. I tried to be as constructive as possible. It even has 17 points on the software engineering stack exchange site (thanks @hvd for the link!). hvd: thanks for the link, the link does answer my question. So I feel it is a sort of duplicate as well, which the SO suggestion engine didn't mention. So it's useful to have a small cross-ref at SO as well? I'd think so, since it helps for Googling the question. And thanks Theodoros for making the distinction between jumping and calling. – Melvin Roest Jan 14 '17 at 10:20
  • 1
    I didn't downvote, but I guess some might feel this isn't a "practical" problem and thus off-topic and thus might have downvoted. – das-g Jan 14 '17 at 13:40
  • What would the right stack exchange be to ask such a question? For me, this question is related to fully understanding programming fundamentals. – Melvin Roest Jan 15 '17 at 14:44

2 Answers2

5

The term call has a wide meaning. When used in calling a function, you would probably best interpret that as short for calling a function for execution. See the following meaning given by the Free Dictionary:

  1. To order or request to undertake a particular activity or work; summon:
    She was called for jury duty. He was called to the priesthood.

This is very close in meaning to another expression used for invoking functions: call upon a function.

That should make sense in the context of functions. The function provides a service, and it is called upon to provide it now. In both cases the meaning is: request the code in a function to be executed.

NB: In Dutch you may translate with oproepen or (less common) aanroepen.

trincot
  • 317,000
  • 35
  • 244
  • 286
  • "Aanroepen" in Dutch feels -- unfortunately -- a bit archaic to me since I don't use it a lot in everyday speech (and programming kind of feels like it's derived from every day speech). Hence I couldn't make much sense of it. – Melvin Roest Jan 14 '17 at 12:14
  • Indeed, *oproepen* is the more common verb in Dutch (I corrected a mistake near the end of the footnote). Other Dutch alternatives to understand how *call* (*roepen*) is involved in the meaning: inroepen, beroep doen op. Anyway, in English I find it better to say *invoke a function*. But *call* is there to stay for the future, as it is used in derived terms, like *call stack*. – trincot Jan 14 '17 at 12:23
0

Thanks to @hvj I noticed that the comments of the really related -- though not the same! Since I want to know it linguistically not historically -- question referenced a paper that was behind a paywall ( see http://dl.acm.org/citation.cfm?id=609816&CFID=888670230&CFTOKEN=46456506 ). I read the paper and then I found this small piece:

In this type of routine it is arranged that a sequence of operations is performed each time the subroutine is called into action.

So apparently the Zeitgeist of that time was phrasing it as calling sub-routines into action. Side note: they also talked about returning control from a sub-routine to the main program.

Melvin Roest
  • 1,392
  • 1
  • 15
  • 31