http://d.puremagic.com/issues/show_bug.cgi?id=11412
Summary: Allow nested pure functions to access outer function variables Product: D Version: D2 Platform: All OS/Version: All Status: NEW Severity: enhancement Priority: P2 Component: DMD AssignedTo: nob...@puremagic.com ReportedBy: verylonglogin....@gmail.com --- Comment #0 from Denis Shelomovskij <verylonglogin....@gmail.com> 2013-11-01 19:57:39 MSK --- As an outer function is a context for its nested function it should be accessible for weakly pure functions just like type instance for member functions: --- struct S { int i; void f() pure { int j; void g() pure { ++i; // ok ++j; // currently error, looks inconsistent } } } --- Also this will allow things like this (usable e.g. for std.conv): --- struct S { void toString(scope void delegate(const(char)[]) pure) pure; } string sToStr(S s) pure { string res; s.toString((chars) { res ~= chars; }); return res; } --- -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------