07 May 2019, 21:35
The point is not to "work with varargs". Varargs would just be a workaround for the restriction placed by parameter count validation.
Normally, there is one function definition and multiple callers. The author of the function decides which parameter it accepts and what they mean, so passing more is not meaningful. The author of the function can decide parameters are optional, and give them default values.
With callbacks, there is one call site and many function definitions. The author of the library which contains the call site decides what the parameters mean. When calling the callback, there is no way to say "these parameters are not required to be handled". Instead (with full parameter count validation), the callback author is required define every parameter, or to accept a variable number of parameters even though it is known in advance exactly how many the function will use.
In some languages, the callback would need to match the predefined signature exactly.