Tuples, CTFE, and Sliding Template Arguments

Steven Schveighoffer schveiguy at gmail.com
Sat Jan 13 00:39:50 UTC 2024


On Saturday, 13 January 2024 at 00:15:56 UTC, Steven 
Schveighoffer wrote:

> This does seem like it has the potential to break code:
>
> ```d
> void foo(int x, Args...)(Args args) {
>
> }
> void foo(Args...)(Args args) {
> }
>
> foo(1, 2, 3); // which is called? Today, the second is
> ```

A more realistic example:

```d
writefln("blah %d", 1)
```

Since `writefln` (and `format`) have string template format 
parameter versions.

Even with an opt-in, there will still be a decision to make (or 
throw an ambiguity error) for matching overloads.

-Steve


More information about the Digitalmars-d mailing list