DIP 1020--Named Parameters--Community Review Round 1

sarn sarn at theartofmachinery.com
Mon Apr 1 23:22:52 UTC 2019


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.


More information about the Digitalmars-d mailing list