DIP 1020--Named Parameters--Community Review Round 1
rikki cattermole
rikki at cattermole.co.nz
Tue Apr 2 00:49:08 UTC 2019
On 02/04/2019 12:22 PM, sarn wrote:
> On Monday, 1 April 2019 at 14:41:20 UTC, rikki cattermole wrote:
>> On 02/04/2019 3:09 AM, Atila Neves wrote:
>>> There are known reasons why using angle brackets complicates lexing
>>> (cough! C++! cough!), so the syntax choice is odd. Is there a
>>> particular reason why the usage suggested here avoids the issues?
>>
>> As far as I'm aware, we should have no problems with adapting dmd-fe
>> to support it.
>>
>> Of course I could have missed something (either in dmd or outside). So
>> it would be good to have somebody else double check that statement.
>
> You already have to deal with the case of variadic function definitions,
> so why not just extend the syntax?
>
> I.e., in this declaration
>
> void foo(int a, int b, ..., int c);
>
> c must be a named argument, even without any special decorators. In that
> case the ... argument acts as a delimiter. So all you need is rules for
> separating positional arguments from named arguments for non-variadic
> functions.
Looks like a good idea, although a poor choice for this DIP.
It could only work for function parameters, it won't work for templates.
I don't think I've seen this idea come up before, so please do explore
it if we don't get another solution in before hand!
More information about the Digitalmars-d
mailing list