[Issue 3492] Can't overload nested functions

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Feb 26 22:43:51 PST 2012


http://d.puremagic.com/issues/show_bug.cgi?id=3492


Jonathan M Davis <jmdavisProg at gmx.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jmdavisProg at gmx.com


--- Comment #5 from Jonathan M Davis <jmdavisProg at gmx.com> 2012-02-26 22:43:51 PST ---
Really? I'm constantly annoyed by that you can't overload nested functions when
writing unit tests. I frequently need to overload functions in unittest blocks
and have to play games to get around the fact that I can't. The worst is when
you use foreach and TypeTuple. You can't just do something like

foreach(T; TypeTuple!(string, wstring, dstring))
{
    void test(T actual, T expected, ...)
    {
    }

    test(...);
    test(...);
    test(...);
    ...
}

because then every subsequent definition of the nested function conflicts with
the rest. You're force to use string mixins simply to give each overload of the
nested function a unique name. It's an extra complication that really shouldn't
be necessary IMHO.

If anything, I'd argue that the lack of ability to overload nested functions is
an unnecassary inconsistency in the language.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list