function argument for map: why shorter form does not compile?

Mindy (0xEAB) desisma at heidel.beer
Sat Jun 20 14:43:56 UTC 2026


On Saturday, 20 June 2026 at 14:23:18 UTC, Ivan Kazmenko wrote:
> Hmm, but in other places, function calls do support partial 
> ctargs specification.
> Consider this example:
>
> ```
> int fun (T1, T2) (T1 x, T2 y)
> {
> 	return x + y;
> }
>
> int gun (T1, Args...) (T1 x, Args args)
> {
> 	return x + args[0];
> }
>
> void main ()
> {
> 	auto a = fun !(int) (5, 7);
> 	auto b = gun !(int) (5, 7);
> 	import std.stdio : writeln;
> 	writeln (a, " ", b); // 12 12
> }
> ```
>
> This does work, not only for `fun` with exactly one additional 
> argument, but also for `gun` with variable number of additional 
> arguments.  What is the difference of this case with the 
> `map+format` case in the original question?

Those are function calls, hence IFTI[0] applies.
In your original example, however, the template is used as an 
alias.

[0] https://dlang.org/spec/glossary.html#ifti


More information about the Digitalmars-d-learn mailing list