A callable object, in computer programming, is any object that can be called like a function.
In different languages
In C++ pointer to function; pointer to member function; functor; lambda expression. std::function is a template class that can hold any callable object that matches its signature. In C++, any class that overloads the function call operator operator() may be called using function-call syntax.
In C# delegate; lambda expression.
In PHP PHP 5.3+ has first-class functions that can be used e.g. as parameter to the usort() function:
It is also possible in PHP 5.3+ to make objects invokable by adding a magic __invoke() method to their class:
In Python In Python, any object with a __call__() method (as well as all functions, classes, and methods) can be called using function-call syntax. The built-in callable function can approximately detect whether a given object is callable or not.
A collections.abc.Callable type annotation can be used to declare that a given variable must be callable. A Callable[P, R], where P is a list of types and R is a type, can be called with values matching P as arguments and returns a value of type R. Other values for P, such as a ParamSpec or ..., denote more flexible cases.
In Dart Callable objects are defined in Dart using the call() method.
In Swift In Swift, callable objects are defined using callAsFunction.
References
External links C++ Callable concept