23

I've always wondered why one calls a function as opposed to, for example, executing it.

A Google search for function call etymology and similar terms turns up nothing useful, Wikipedia doesn't mention it, online dictionaries have either no entry at all or no etymology section.

Where did the notion of 'calling' a function come from?

9
  • It probably comes from the different semantics for handling the arguments - call by value, call by reference, call by name, etc. I also imagine that the term originated with "procedure call" or "subroutine call" and was only applied to functions later. In mathematics you apply functions to their arguments, and what we call functions are almost always procedures/subroutines (because mathematical functions don't have side effects).
    – Doval
    Aug 18, 2014 at 18:28
  • @Doval: Yes, but why use the very "call" in "procedure call" instead of a different verb? Aug 18, 2014 at 18:46
  • 2
    @FrustratedWithFormsDesigner No clue, but I figured they'd have better luck trying to find the origins of "subroutine call" or "procedure call" than "function call", which doesn't make sense historically. I realize the comment doesn't answer the question, but that's precisely why I made it a comment and not an answer.
    – Doval
    Aug 18, 2014 at 18:47
  • 2
    In lambda-calculus you apply a function (and the lambda operator is making abstractions). Some languages speak of invoking, not calling, a function. Aug 18, 2014 at 18:53
  • 2
    In some dialects of assembly language (such as x86 assembly) the opcodes are named call and ret or some variant thereof. It is possible that programming languages inherited the terminology from the underlying hardware, although that would still leave the question of why the hardware designers chose those names for the operations. Aug 18, 2014 at 19:28

2 Answers 2

20

The word call goes back at least to Fortran, the first widely used programming language. In Fortran, CALL is a keyword that passes control to a subroutine. It's not clear why John Backus chose that word to invoke subroutines -- you may need to read one or more biographies of Backus to discover that -- but it seems likely that the use in Fortran is the reason that we use the word call today with respect to functions, methods, etc.

Note that the use of call with respect to functions and other subroutines also fits well with several English-language definitions of call:

  • to make a brief visit
  • to demand something
  • to rouse from sleep
  • to invite
11
  • 3
    OP wants to know why CALL in the first place. Aug 18, 2014 at 18:28
  • 6
    David Wheeler's 1952 ACM paper The use of sub-routines in programmes describes the concept, and I'd bet the use of the term "call" evolved between then and the appearance of CALL and RETURN in FORTRAN II in 1958, if it wasn't used in the paper itself. (I'm too cheap to pay the ACM $15 to find out.)
    – Blrfl
    Aug 18, 2014 at 18:40
  • 2
    @Timo Although I can't point to the origin of the term, my goal with this answer was to get you closer to that point. Knowing that CALL shows up in this context in Fortran (created in 1954) should significantly narrow the search for the origin. Blrfl's comment above looks like a good bound on the early side, so together we've narrowed the time period in which the term seems to have come into use to a few years.
    – Caleb
    Aug 18, 2014 at 18:59
  • 2
    @Caleb: CALL wasn't a part of the first version of FORTRAN. See page 1 of the IBM Fortran II Reference Manual.
    – Blrfl
    Aug 18, 2014 at 19:15
  • 2
    @Blrfl I skimmed the paper, it does not use the term call or any other term, it mostly just talks about use of subroutines. Aug 18, 2014 at 19:45
2

1947:

In January 1947 John Mauchly presented general notes at 'A Symposium of Large Scale Digital Calculating Machinery' under the joint sponsorship of Harvard University and the Bureau of Ordnance, United States Navy.

...a coding instruction for placing the subroutines in the memory at places known to the machine, and in such a way that they may easily be called into use."

https://en.wikipedia.org/wiki/Function_(computer_programming)#History

1
  • This seems like more evidence that use of call in early computing languages like FORTRAN comes directly from English usage at the time. The word can be used with a number of prepositions that each change its meaning a bit: call up, call back, call on, call out, call to, call for, etc., but it can also be used alone as a way to request service, e.g. call the butler. I'm not sure it's worth updating my 10yo answer, but the ultimate answer to OP's question about where the word came from seems to be "from common English usage."
    – Caleb
    Jan 29 at 15:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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