I was using nested functions to break in small pieces part of my code but when I needed to extend a function to support parameters of different types I get a redeclaration compile-error:
declaration X is already defiend
Is this D's designer (if so, why?) or one of this kind of feature they don't implemented just because is "too few used"?
Code example to reproduce error:
void foo()
{
int baa(int a)
{
return a * 2;
}
int baa(int a, int b)
{
return a + b;
}
}
You'll find all the details and track progress from https://issues.dlang.org/show_bug.cgi?id=12578
Local functions aren't visible outside of their scope. Their use is pretty limited, and so there isn't much of any benefit to overloadability.
Forward references aren't allowed in local scope, meaning any use of overloading would be fairly restricted anyway.
It's not impossible to overcome this, it just seems pointless.
-- Walter Bright