overloading

Lars T. Kyllingstad public at kyllingen.NOSPAMnet
Wed Aug 12 01:14:34 PDT 2009


Ellery Newcomer wrote:
> Why is function overloading not applied to nested functions?


Good question. Intuitively it seems to me that they should act just like 
other functions. I couldn't find anything about it in the spec, but I 
found this (on the "Functions" page):

     Unlike module level declarations, declarations within
     function scope are processed in order. This means that
     two nested functions cannot mutually call each other:

     void test()
     {
         void foo() { bar(); }    // error, bar not defined
         void bar() { foo(); }    // ok
     }

Perhaps this also causes problems with overloading?

-Lars


More information about the Digitalmars-d-learn mailing list