This code fails to compile: ("undefined identifier fun")
void main() {
    fun();
    void fun() {}
}

Having the call after the declaration works:
void main() {
    void fun() {}
    fun();
}

Is this how it is intended to work?

It seems goofy that this works:
void main() {
    void fun2() {}
    void fun() {
         fun2()
    }
    fun();
}

But this fails to compile: ("undefined identifier fun2")
void main() {
    void fun() {
         fun2()
    }
    void fun2() {}
    fun();
}

What if I wanted this?
void main() {
    void fun2() {fun();}
    void fun() {fun2();}
    fun();
}

I can't see how the current behavior is at all better or to be preferred unless it is faster to compile? What is the reason for it being how it is?

Reply via email to