Yet another terrible compile time argument proposal

Timon Gehr timon.gehr at gmx.ch
Sun Jan 14 22:19:05 UTC 2024


On 1/14/24 23:15, Timon Gehr wrote:
> ```d
> void foo(int x)(int:x, int y){ }
> 
> void main(){
>      foo(1,2); // calls foo!1(2)
>      foo(2,3); // calls foo!2(3)
> }
> ```

As Steven points out, this should of course have been:

```d
void foo(int x)(int:x, int y){ }

void main(){
     foo(1,2); // calls foo!1(1,2)
     foo(2,3); // calls foo!2(2,3)
}
```

> 
> Maybe it is best to restrict `:` syntax to `enum` parameters but then at least the template parameter list is not being modified by the feature. 

But this still holds and then that example would not even compile.


More information about the Digitalmars-d mailing list