I dun a DIP, possibly the best DIP ever

WebFreak001 d.forum at webfreak.org
Thu Apr 23 14:17:37 UTC 2020


On Thursday, 23 April 2020 at 14:06:03 UTC, Stefan Koch wrote:
> On Thursday, 23 April 2020 at 13:48:54 UTC, Steven 
> Schveighoffer wrote:
>>
>> No, Foo!(AliasSeq!(1, 2)...)... is equivalent to 
>> Foo!(AliasSeq!(1, 2))
>>
> In the current implementation it's a parser error.

I would assume that both

alias Numbers = AliasSeq!(1, 2);
Foo!(Numbers...)

and

Foo!(AliasSeq!(1, 2)...)

should do the same, no?

I think of something like (expr + Tuple)... as a simple map!(Item 
=> expr + Item) - however the compiler automatically finding the 
Tuple and the scope of the expression really bugs me the most 
here because it feels so subjective.

Wouldn't some syntax like Tuple->{Tuple + 4} be clearer and 
easier to parse for both DMD and static analysis tools? To keep 
it as simple as possible it would just reuse the name of the 
tuple as item name, but then it's basically a fancy, clear map 
syntax, where you exactly control the tuple that's being expanded 
and avoid any issues with nested tuples in the expression tree.


More information about the Digitalmars-d mailing list