# Does the callback concept of programming have any basis in computer science?

Although I seriously code with computer languages in general since 2010 and as an amateur programmer with programming languages in particular since 2015 (primarily Bash and JavaScript imperative scripts) and codes I wrote are scattered through my Stack Exchange accounts, as in my Code Review SE account,
I think I still misunderstand what a Callback is;
I feel that the term itself might be misleading, as I understand that callback functions doesn't "call back" anything, but rather "called back" as a reaction to a condition (event).
I understand the alternative term Callafter as significantly controversial between programmers, so I stay with "Callback" or its semantic siblings;

## My question

Because the particular examples I read of this concept in Bash and JavaScript are not remembered to me as clear, I ask:

Does the callback concept of programming have any basis in computer science?

That is to ask; is there, as part of a computer science theory, some logical formula that can simulate all possible "callback functions" (similarly to as a Turing machine can simulate all possible functions of a computer) that might help understanding the purpose of this concept?
An answer might help me understand what is the common denominator (if there is one) between different "callback" terms in programming.

• I might be misunderstanding your question, but note that "callback function" is contextual. A sort routine may use "less than" or "greater than" callbacks to sort a list in ascending or descending order, but you can still use "less than" in ordinary non-callback contexts. – MSalters Jan 20 at 11:15
• – user109446 Feb 2 at 9:12

• Hello ; I ran a search query in the linked Wikipedia article for callback and found only a link to the Callback Wikipedia article itself, which I find unclear and found unclear in the past and consider as a non didactic learning material at least now for me personally; hence, please explain what you mean by family member of higher order functions; otherwise, sadly and with all honesty, the answer doesn't help me to understand the concept. – user109446 Jan 20 at 12:41
• @JohnDoea: Searching for just the word "callback" indeed gives you little results. For instance, it would miss the link to the map page, which is a basic example of a function taking a callback (applies a callback function to all elements of a list). All the examples on the higher-order function page are in fact examples of callbacks - add3 is passed as the callback function. – MSalters Jan 20 at 14:39