I do not know whether this should be an enhancement or bug. Variadic parameters for lambdas are unspecified. The syntax is accepted, but any attempt to instantiate such a lambda with multiple arguments results in a semantic error.
alias foo = (a...) {
};
void main() {
foo(1, 2);
}
onlineapp.d(5): Error: template onlineapp.__lambda4 cannot deduce function from argument types !()(int, int), candidates are:
onlineapp.d(1): onlineapp.__lambda4
https://run.dlang.io/is/lByBjC
Why are variadic lambdas needed (apart from they should just work)? At present, -betterC tries to do codegen for functions that are only intended for CTFE, unjustifiably precluding CTFE for anything that requires GC, typeinfo etc. The only existing workaround is to transform the functions into lamdas. However, writing functions such as string formatters is painful without variadic parameters. It would become bearable, if this bug is fixed, until a proper way of marking CTFE-only functions is implemented.
Comment #1 by robert.schadek — 2024-12-13T19:05:53Z