www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - overloading

reply Ellery Newcomer <ellery-newcomer utulsa.edu> writes:
Why is function overloading not applied to nested functions?
Aug 11 2009
parent "Lars T. Kyllingstad" <public kyllingen.NOSPAMnet> writes:
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
Aug 12 2009