On Wednesday, 3 February 2016 at 15:09:35 UTC, Adam D. Ruppe wrote:
Read my post here:

http://stackoverflow.com/questions/34398408/struct-declaration-order/34398642#34398642

then see if you can use the same reasoning on your problem.

This indeed works without any other tricks such as compile-time parameters:

-----
import std.stdio;

void outerFun () {
    struct Holder {
        static struct S {
            void fun2 (int x) {
                writeln (x);
                if (x > 0) fun1 (x - 1);
            }
        }

        static S s;

        static void fun1 (int y) {
            writeln (y);
            if (y > 1) s.fun2 (y - 2);
        }
    }

    Holder.fun1 (10);
}

void main () {outerFun ();}
-----

Thank you!

Ivan Kazmenko.

Reply via email to