Clemens:
> void foo(int x)
> {
> void fooImpl(int x, int depth);
> {
> // ...
> }
>
> fooImpl(x, 0);
> }
OK, I'll use a static nested function then, it's not as clean as adding a
"private" attribute, but probably there's not enough need to add other features
to the language:
int foo4(int x) {
int foo4inner(int x, depth=0) {
...
foo4inner(x, depth + 1);
...
}
return foo4inner(x);
}
void main() {
int r = foo4(5); // OK
int r = foo4(5, 1); // Error
int r = foo4(5, 0); // Error
}
The compiler probably takes care of always optimize the extra function call
away.
Bye and thank you,
bearophile