Calling nested function before declaration

Timon Gehr timon.gehr at gmx.ch
Thu Sep 27 18:28:54 UTC 2018


On 27.09.2018 01:05, Neia Neutuladh wrote:
> 
> The standard ways of dealing with this:
> 
> * Reorder the declarations.
> * Make the functions non-nested.
> * Get rid of mutual recursion.
> * Use a delegate.
> * Do a method-to-method-object refactoring.

* turn the function with the forward reference into a template

void main() {
     void fun()() {
         fun2();
     }
     void fun2() {}
     fun(); // ok
}


More information about the Digitalmars-d mailing list