[Issue 16467] templated function default argument take into account when not needed

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Wed Sep 7 08:54:40 PDT 2016


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

--- Comment #2 from Lodovico Giaretta <lodovico at giaretart.net> ---
(In reply to Jonathan M Davis from comment #1)
> [...]

Yeah, I understand the reasons. I decided to put this here as an enhancement
request because there are cases in which it's *very* ugly.

In my use case I have a default callback parameter. If I choose a default that
is not @safe pure @nogc nothrow, my users will get an error when their
callbacks are, because my default does not fit their type.
I'm forced to add an overload without that parameter, which kinda defeats the
purpose of default parameters and, most important, doubles the number of
overloads needed. I had a case in which four overloads became eight because of
this.

But of course this may not be a compelling enough reason, especially if the
needed changes would be big or have bad side effects. In that case, feel free
to close as WONTFIX or INVALID.

--


More information about the Digitalmars-d-bugs mailing list