17

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?

  • 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 '14 at 18:28
  • @Doval: Yes, but why use the very "call" in "procedure call" instead of a different verb? – FrustratedWithFormsDesigner Aug 18 '14 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 '14 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. – Basile Starynkevitch Aug 18 '14 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. – David Conrad Aug 18 '14 at 19:28
15

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
  • 3
    OP wants to know why CALL in the first place. – Tulains Córdova Aug 18 '14 at 18:28
  • 5
    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 '14 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 '14 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 '14 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. – Lars Viklund Aug 18 '14 at 19:45

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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