DIP 1030--Named Arguments--Community Review Round 1 Discussion
Steven Schveighoffer
schveiguy at gmail.com
Tue Feb 11 19:18:06 UTC 2020
On 2/11/20 2:07 PM, Walter Bright wrote:
> On 2/11/2020 5:52 AM, Steven Schveighoffer wrote:
>> An example:
>>
>> foo(a: 1, b:2);
>>
>> Now I want to replace all calls to foo with a special wrapper that
>> logs all calls.
>>
>> alias foo = logCalls!(.foo);
>>
>> foo(a: 1, b:2); // error, cannot use named parameters with tuples.
>>
>> Is there a plan to mitigate this limitation?
>
> Currently, no.
>
> The current plan is named arguments will not match to ...
>
> This leaves the door open to a future enhancement along those lines,
> which is better than trying to gin up an awkward solution.
I disagree. If you don't do something about this, the entire realm of
wrapping types and functions becomes convoluted and sometimes
impossible, because you can't wrap things and have them behave as the
original thing as easily as you can today.
If we can't figure out a solution, I would say we hold off on named
parameters. D's major strength is compile-time introspection and code
generation, and this DIP adds a whole new aspect of API that is
off-limits to introspection.
-Steve
More information about the Digitalmars-d
mailing list