[Issue 19057] 2.079 changelog variadic template and default arguments

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Jul 8 07:19:34 UTC 2018


https://issues.dlang.org/show_bug.cgi?id=19057

--- Comment #14 from Jonathan M Davis <issues.dlang at jmdavisProg.com> ---
The current behavior works well with default arguments, because then they never
get accidentally matched, whereas IFTI is allowed to match arguments against
them, then it becomes trivial to match them accidentally, and if that were the
case, I'd argue strongly that putting default arguments on parameters that come
after variadic parameters was too error-prone for it to make any sense. At
least in the case where there are no default arguments, you always have to
provide the arguments, so it's expected. But once you have default arguments,
those arguments are no longer expected, and it becomes trivial to think that
you're passing an argument that matches the variadic parameters but ends up
matching at least one of the parameters after the variadic parameters. The
behavior would be fatal for any attempt at something like logging because of
how much would accidentally match against __FILE__, but any case where you have
parameters with default arguments following varidiac parameters would be very
error-prone unless the types involved were extremely unlikely to be passed to
the function. I fail to see why having the parameters with default arguments
matching with IFTI would ever be desirable. It's just too error-prone.

--


More information about the Digitalmars-d-bugs mailing list