
Description
The issue of forwarding was raised on multiple occasions during dart history.
The tuple of actual arguments can help, it's just a matter of finding a good syntax. The first thing that comes to mind is $arguments
:
myFunction(int a, int b, {String s=""}) {
anotherFunction(...$arguments); // forwarding
anotherFunction(...$arguments with (_, 10, "Hello"));
}
There's a related issue: how to declare tuple type based on the argument list of existing function?
I can't find any prior example of anything like that in dart. One obvious variant is:
typedef MyTupleType=someFunction.$arguments
which I don't like because it works (kinda) only in the context of typedef, but is no good as a type expression - e.g. this declaration is weird:
someFunction.$arguments myTuple; // variable of type someFunction.$arguments
Another variant can be
(...someFunction.$arguments) myTuple;
but this is too fancy.
EDIT: If dart introduces compile-time macros like #nameOf(foo.bar)
then the natural idea would be to define yet another macro for the function argument tuples, with a more articulate syntax
#tupleTypeOf(myFunction) tuple=(1, 2, s="hello");
or something to that effect