Lookhead for nested functions

Timon Gehr timon.gehr at gmx.ch
Fri Jun 14 12:50:38 UTC 2019


On 14.06.19 07:35, Amex wrote:
> fails:
> 
> void foo()
> {
>     bar();
>     void bar() { }
> }
> 
> passes:
> 
> void foo()
> {
>     void bar() { }
>     bar();
> }
> 
> 
> I realize this may not be a simple solution in all cases but surely it 
> can be make to work in such simple cases?
> 
> 
> 
> 

If you need mutual recursion for local functions, this hack works:

void foo(){
     void bar()(){ baz(); }
     void baz(){ bar(); }
}


More information about the Digitalmars-d mailing list