Phrase origin: Why do we "call" functions?

78 todsacerdoti 52 7/9/2025, 4:04:45 AM quuxplusone.github.io ↗

Comments (52)

userbinator · 4h ago
Somewhat less frequently, I also hear "invoke" or "execute", which is more verbose but also more generic.

Incidentally, I find strange misuses of "call" ("calling a command", "calling a button") one of the more grating phrases used by ESL CS students.

spudlyo · 3h ago
Invoke comes from Latin invocō, invocāre, meaning “to call upon”. I wouldn’t view it as a misuse, but rather a shortening.
thaumasiotes · 2h ago
> Invoke comes from Latin invocō, invocāre, meaning “to call upon”.

(In the way you'd call upon a skill, not in the way you'd call upon a neighbor.)

pansa2 · 3h ago
> strange misuses of "call"

My favourite (least favourite?) is using “call” with “return”. On more than one occasion I’ve heard:

“When we call the return keyword, the function ends.”

jamesfinlayson · 2h ago
I remember someone in university talking about the if function (which ostensibly takes one boolean argument).
weinzierl · 2h ago
Sounds like something Prof. John Ousterhout would say:-; The place where this was literally accurate would be Tcl.

I don't know enough Smalltalk to be sure but I think to remember it has a similar approach of everything is an object and I wouldn't be surprised if they'd coerced control flow somehow into this framework.

Also Forth comes to mind, but that would probably be a stretch.

antonvs · 44m ago
Try implementing that in most languages and you'll run into problems.

In an imperative programming language with eager evaluation, i.e. where arguments are evaluated before applying the function, implementing `if` as a function will evaluate both the "then" and "else" alternatives, which will have undesirable behavior if the alternatives can have side effects.

In a pure but still eager functional language this can work better, if it's not possible for the alternatives to have side effects. But it's still inefficient, because you're evaluating expressions whose result will be discarded, which is just wasted computation.

In a lazy functional language, you can have a viable `if` function, because it will only evaluate the argument that's needed. But even in the lazy functional language Haskell, `if` is implemented as built-in syntax, for usability reasons - if the compiler understands what `if` means as opposed to treating it as an ordinary function, it can optimize better, produce better messages, etc.

In a language with the right kind of macros, you can define `if` as a macro. Typically in that case, its arguments might be wrapped in lambdas, by the macro, to allow them to be evaluated only as needed. But Scheme and Lisp, which have the right kind of macros, don't define `if` as a macro for similar reasons to Haskell.

One language in which `if` is a function is the pure lambda calculus, but no-one writes real code in that.

The only "major" language I can think of in which `if` is actually a function (well, a couple of methods) is Smalltalk, and in that case it works because the arguments to it are code blocks, i.e. essentially lambdas.

tl;dr: `if` as a function isn't practical in most languages.

Findecanor · 2h ago
There are languages in which `if` is a function.

In in Tcl, `if` is called a "command".

userbinator · 2h ago
I've heard that too --- the voice in my head automatically read it in the customary thick Indian accent.
pwdisswordfishz · 1h ago
Eh, "return" is just a very restricted continuation with special syntax… it's a stretch to say you "call" it, but not unjustified.
Dwedit · 3h ago
C# seems to like to use "Invoke" for things like delegates or reflected methods. Then it proceeds to use "Call Stack" in the debugger view.
treyd · 3h ago
I actually see the converse often with novices often, referring to statements (or even entire function decls) as "commands".
kragen · 3h ago
"Command" is a better term for what we call "statements" in imperative programming languages. "Statement" in this context is an unfortunate historical term; except in Prolog, these "statements" don't have a truth-value, just an effect. (And in Prolog we call them "clauses" instead.)
Swiffy0 · 41m ago
I'm Finnish and in in Finnish we translate "call" in function context as "kutsua", which when translated back into English becomes "invite" or "summon".

So at least in Finnish the word "call" is considered to mean what it means in a context like "a mother called her children back inside from the yard" instead of "call" as in "Joe made a call to his friend" or "what do you call this color?".

Just felt like sharing.

ks2048 · 3h ago
There is also the phrase in music, "call and response" - even referencing a return value.
skaushik92 · 4h ago
> ... but those of any complexity presumably ought to be in a library — that is, a set of magnetic tapes in which previously coded problems of permanent value are stored.

Oddly, I never thought of the term library as originating from a physical labelled and organized shelf of tapes, until now.

zabzonk · 3h ago
I've never heard of a library being called anything else - look at the common file extension .lib, for example.
walthamstow · 3h ago
Off topic somewhat but where the hell did the verb 'jump' come from for video calls? I'm always being asked to jump on a call
mook · 2h ago
I assume it's because you're doing something you'd rather not do to benefit somebody else, much like you'd jump on a grenade :p
Brian_K_White · 1h ago
You would jump on a call before video was involved. Not even necessarily a conference call either, you could jump on the horn etc.

It just means to start doing something, no great mystery.

klodolph · 2h ago
I always thought it was just a metaphor for suddenly leaving whatever you were doing at the time. You’re doing something else, and then you jump on a call. You don’t mosey on over and show up on the call fifteen minutes later.
IshKebab · 1h ago
That's just a standard meaning of the word jump. You're jumping from whatever you were doing to a video call.
kragen · 2h ago
Maybe it's a hint that the operation is irreversible! :-)
lgas · 2h ago
This was a result of Zoom's acquisition of the band House of Pain.
toast0 · 2h ago
Thought it was Kris Kross.
kragen · 3h ago
It's interesting to think of "calling" as "summoning" functions. We could also reasonably say "instantiating", "evaluating", "computing", "running", "performing" (as in COBOL), or simply "doing".

In Mauchly's "Preparation of Problems for EDVAC-Type Machines", quoted in part in the blog post, he writes:

> The total number of operations for which instructions must be provided will usually be exceedingly large, so that the instruction sequence would be far in excess of the internal memory capacity. However, such an instruction sequence is never a random sequence, and can usually be synthesized from subsequences which frequently recur.

> By providing the necessary subsequences, which may be utilized as often as desired, together with a master sequence directing the use of these subsequences, compact and easily set up instructions for very complex problems can be achieved.

The verbs he uses here for subroutine calls are "utilize" and "direct". Later in the paper he uses the term "subroutine" rather than "subsequence", and does say "called for" but not in reference to the subroutine invocation operation in the machine:

> For these, magnetic tapes containing the series of orders required for the operation can be prepared once and be made available for use when called for in a particular problem. In order that such subroutines, as they can well be called, be truly general, the machine must be endowed with the ability to modify instructions, such as placing specific quantities into general subroutines. Thus is created a new set of operations which might be said to form a calculus of instructions.

Of course nowadays we do not pass arguments to subroutines by modifying their code, but index registers had not yet been invented, so every memory address referenced had to be contained in the instructions that referenced it. (This was considered one of the great benefits of keeping the program in the data memory!)

A little lower down he says "initiate subroutines" and "transferring control to a subroutine", and talks about linking in subroutines from a "library", as quoted in the post.

He never calls subroutines "functions"; I'm not sure where that usage comes from, but certainly by BASIC and LISP there were "functions" that were at least implemented by subroutines. He does talk about mathematical functions being computed by subroutines, including things like matrix multiplication:

> If the subroutine is merely to calculate a function for a single argument, (...)

seabass · 3h ago
I love this sort of cs history. I’m also curious—why do we “throw” an error or “raise” an exception? Why did the for loop use “for” instead of, say, “loop”?
antod · 3h ago
I'm guessing "throw" came about after someone decided to "catch" errors.

As for "raise", maybe exceptions should've been called objections.

yongjik · 1h ago
It's been ages, but I think an earlier edition of Stroustrup's The C++ Programming Language explains that he specifically chose "throw" and "catch" because more obvious choices like "signal" were already taken by established C programs and choosing "unusual" words (like "throw" and "catch") reduced chance of collision. (C interoperability was a pretty big selling point in the early days of C++.)
baq · 2h ago
You throw something catchable and if you fail to catch it it’ll break. Unless it’s a steel ball.

You raise flags or issues, which are good descriptions of an exception.

flufluflufluffy · 3h ago
I think “raise” comes from the fact that the exception propagates “upward” through the call stack, delegating the handling of it to the next level “up.” “Throw” may have to do with the idea of not knowing what to do/how to handle an error case, so you just throw it away (or throw your hands up in frustration xD). Totally just guessing
owlbite · 3h ago
I suspect it comes from raising flags/signals (literally as one might run a flag up a flag pole?) to indicates CPU conditions, and then that terminology getting propagated from hw to sw.
Findecanor · 2h ago
Sounds plausuble. Some of the earliest exception handling systems did not have any semantic difference between CPU exceptions and software exceptions.
comex · 2h ago
I would have thought it came from the concept of 'raising an issue' or even 'raising a stink'.
titanomachy · 3h ago
That's a great question. The first language I learned was python, and "for i in range(10)" makes a lot of sense to me. But "for (int i = 0; i < 10; i++)" must have come first, and in that case "for" is a less obvious choice.
Dwedit · 3h ago
BASIC had the FOR-NEXT loop back in 1964.

10 FOR N = 1 TO 10

20 PRINT " ";

30 NEXT N

C language would first release in 1972, that had the three-part `for` with assignment, condition, and increment parts.

kahirsch · 1h ago
This reminds me of a little bit of trivia. In very old versions of BASIC, "FORD=STOP" would be parsed as "FOR D = S TO P".

I found that amusing circa 1975.

zabzonk · 3h ago
In Fortran, it is a do-loop :)
bee_rider · 2h ago
Fortran has grown a lot over time. If somebody said it don’t have a do loop in 196X, I wouldn’t be too surprised.

Really it’s just syntactic sugar, just use a goto.

pklausler · 2h ago
The entire point of Fortran was being an effective optimizing compiler for DO loops.
masklinn · 3h ago
FOR comes from ALGOL in which as far as I know is was spelled:

    for p := x step d until n do
QuesnayJr · 3h ago
Algol 58 had "for i:=0(1)9". C's for loop is a more general variant.
gmueckl · 1h ago
"For" for loop statements fits with math jargon: "for every integer i in the set [1:20], ..."
pansa2 · 2h ago
“for” is short for “for each”, presumably. `for i in 1..=10` is short for “for each integer i in the range 1 to 10”.
monkpit · 2h ago
You “call upon” the function to perform a task, or return a value as the case may be. Just as you may call upon a servant or whatever.
thaumasiotes · 2h ago
The answer is in the article. You "call" functions because they are stored in libraries, like books, and like books in libraries, when you want them, you identify which one you want by specifying its "call number".
dleeftink · 4h ago
Also interesting to contrast this to invocation or application (e.g. to invoke or apply). I'm sure there are fair few 'functional dialects' out there!
ranger_danger · 4h ago
I seem to remember people used to say "call it up" when asking an operator to perform a function on a computer when the result was displayed in front of the user.
artemonster · 2h ago
Also exists: „activate“ from activation record
lubosm · 2h ago
I'd like to point at CALL, a CPU instruction, and its origins. I'm not familiar with this, but it could reveal more than programming languages. The instruction is present at least since first intel microprocessors and microcontrollers were designed.
aitchnyu · 2h ago
I kept scrolling expecting to see this story:

> Dennis Ritchie encouraged modularity by telling all and sundry that function calls were really, really cheap in C. Everybody started writing small functions and modularizing. Years later we found out that function calls were still expensive on the PDP-11, and VAX code was often spending 50% of its time in the CALLS instruction. Dennis had lied to us! But it was too late; we were all hooked...

https://www.catb.org/~esr/writings/taoup/html/modularitychap...

kragen · 2h ago
The first Intel microcontrollers were the 8008 and the 4004, designed in 01971. This is 13 years after this post documents the "CALL X" statement of FORTRAN II in 01958, shortly after which (he documents) the terminology became ubiquitous. (FORTRAN I didn't have subroutines.)

In the Algol 58 report https://www.softwarepreservation.org/projects/ALGOL/report/A... we have "procedures" and "functions" as types of subroutines. About invoking procedures, it says:

> 9. Procedure statements

> A procedure statement serves to initiate (call for) the execution of a procedure, which is a closed and self-contained process with a fixed ordered set of input and output parameters, permanently defined by a procedure declaration. (cf. procedure declaration.)

Note that this does go to extra pains to include the term "call for", but does not use the phraseology "call a procedure". Rather, it calls for not the procedure itself, but the execution of the procedure.

However, it also uses the term "procedure call" to describe either the initiation or the execution of the procedure:

> The procedure declaration defining the called procedure contains, in its heading, a string of symbols identical in form to the procedure statement, and the formal parameters occupying input and output parameter positions there give complete information concerning the admissibility of parameters used in any procedure call, (...)

Algol 58 has a different structure for defining functions rather than procedures, but those too are invoked by a "function call"—but not by "calling the function".

I'm not sure when the first assembly language with a "call" instruction appeared, but it might even be earlier than 01958. The Burroughs 5000 seems like it would be a promising thing to look at. But certainly many assembly languages from the time didn't; even MIX used a STJ instruction to set the return address in the return instruction in the called subroutine and then just jumped to its entry point, and the PDP-10 used PUSHJ IIRC. The 360 used BALR, branch and link register, much like RISC-V's JALR today.