digitalmars.D.bugs - [Issue 11412] New: Allow nested pure functions to access outer function variables
- d-bugmail puremagic.com (48/48) Nov 01 2013 http://d.puremagic.com/issues/show_bug.cgi?id=11412
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: nobody puremagic.com ReportedBy: verylonglogin.reg gmail.com 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: -------
Nov 01 2013