Function pointers/delegates default args were stealth removed?
Simen Kjaeraas
simen.kjaras at gmail.com
Mon Aug 27 03:12:03 PDT 2012
On Mon, 27 Aug 2012 11:57:45 +0200, Carl Sturtivant <sturtivant at gmail.com>
wrote:
>> 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 *do* know you're talking to yourself, right?
--
Simen
More information about the Digitalmars-d
mailing list