Suppose a function pointer can be called with fewer actual
arguments than the number of parameters in its declaration.
Suppose that when such a call is made, the missing arguments
will always be assigned the default initialization for their
types (default default-arguments!). Now suppose that a language
mechanism is provided so that code in the function body can
determine how many actual arguments were supplied at the point
of call.
Now any function pointer can simulate other default arguments
(non-default default arguments) by testing the actual number of
arguments supplied and assigning defaults overtly to the
remainder inside the function body. No need for new types: this
is a run-time action.
That's a great idea Carl! You mean something like this:
int sum(int a, int b) {
if( argc == 1 ) b = 1; //default for b if not supplied
return a + b;
}
//...
auto f = ∑
//...
auto x = sum(y); //function pointer call, so fewer args permitted