Andrei Alexandrescu wrote: > module my_module; > > void fun() > { > import std.random; > return uniform(0, 100); > } > > int gun() > { > import std.stdio; > writeln(fun()); > } > > This module won't compile in today's D, but not for a matter of > principles; it's just a random limitation of the language. (It does work > if you import from within a class or struct.) You can insert most > declarations in a scope, so the ones you can't insert are just awkward > exceptions, unless there's a good reason to actively disable them. Any > code should work if you just wrap another scope around it.
//void main(){ immutable a = b; immutable b = 1; int foo(int n){ if(n==1) return 1; return 1+bar(n); } int bar(int n){ if(n&1) return foo(3*n+1); return foo(n/2); } //} Will this be fixed too? Timon