[Issue 7459] working around nested function declaration order
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Fri Dec 14 00:20:12 PST 2012
http://d.puremagic.com/issues/show_bug.cgi?id=7459
--- Comment #2 from timon.gehr at gmx.ch 2012-12-14 00:20:08 PST ---
(In reply to comment #1)
> Ideally, the compiler should allow nested functions to call each other.
I agree. Furthermore, ideally the state of the symbol table should the one at
the declaration of the template.
> I understand there are some complications with how declarations inside function
> scope are processed, but is there a way to treat function declarations
> differently from variable declarations?
There are no complications specific to local declarations, except maybe some
kind of conservative definite initalization analysis. I guess it's just not
implemented and the spec has been modelled after the implementation. An
implementation would have to make sure to handle mixins correctly. (just
looking at syntactic properties is not enough to decide whether something can
be forward-referenced because of those.)
string foo(){ return "foo"; }
void fun(){
string gen(){ return "void "~foo()~"(){ return `baz`; } ";
mixin(gen());
}
The above code should be a compiler error. (Similar examples can be constructed
in unordered scopes.)
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list