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

Ivan Kazmenko gassa at mail.ru
Sat Jun 20 21:21:32 UTC 2026


On Saturday, 20 June 2026 at 14:43:56 UTC, Mindy (0xEAB) wrote:
> Those are function calls, hence IFTI[0] applies.
> In your original example, however, the template is used as an 
> alias.

Hmm, I see the difference now, thanks.

Still. Nick suggested a library-side fix above: to separate, on 
the template level, the first argument of `format` from the other 
arguments. If this separation works, the next logical steps seem 
to be:

1. Do this to every library function for better flexibility.

2. Better, on the compiler side, do a lowering of every 
multi-argument template into a chain of nested single-argument 
templates.

3. Better still, on the compiler side, support something 
IFTI-like for aliases.

But it didn't happen. So I guess I'm missing some rationale here. 
Perhaps it's something about when each template is instantiated, 
and the instantiation cannot be postponed in the general case?..

Just, the original example, where `map!format` fails but 
`map!(x=>format(x))` works, still seems like an arbitrary quirk 
to me.

Ivan Kazmenko.



More information about the Digitalmars-d-learn mailing list