digitalmars.D.bugs - [Issue 6550] New: Allow (auto var = expression) in while() loops
- d-bugmail puremagic.com (44/44) Aug 24 2011 http://d.puremagic.com/issues/show_bug.cgi?id=6550
- d-bugmail puremagic.com (10/10) Aug 24 2011 http://d.puremagic.com/issues/show_bug.cgi?id=6550
- d-bugmail puremagic.com (12/12) Aug 27 2011 http://d.puremagic.com/issues/show_bug.cgi?id=6550
http://d.puremagic.com/issues/show_bug.cgi?id=6550 Summary: Allow (auto var = expression) in while() loops Product: D Version: D2 Platform: Other OS/Version: All Status: NEW Severity: enhancement Priority: P2 Component: DMD AssignedTo: nobody puremagic.com ReportedBy: andrej.mitrovich gmail.com --- Comment #0 from Andrej Mitrovic <andrej.mitrovich gmail.com> 2011-08-24 12:42:26 PDT --- Currently this doesn't compile: while (auto parent = foo.parent) { foo = parent; } Error: expression expected, not 'auto' This is useful to replace this kind of loop (assume foo is a class object that has a 'parent' field): while (true) { if (auto parent = foo.parent) { // do something with parent foo = parent; // switch to next parent } else { break; } } with the simpler: while (auto parent = foo.parent) { // do something with parent foo = parent; // switch to next parent } Currently `if` statements already allow this syntax, so it seems natural to extend this to `while` loops. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Aug 24 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6550 timon.gehr gmx.ch changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |timon.gehr gmx.ch --- Comment #1 from timon.gehr gmx.ch 2011-08-24 13:12:24 PDT --- note that this can be implemented with a simple rewrite rule. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Aug 24 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6550 yebblies <yebblies gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED CC| |yebblies gmail.com Resolution| |DUPLICATE --- Comment #2 from yebblies <yebblies gmail.com> 2011-08-28 02:17:45 EST --- *** This issue has been marked as a duplicate of issue 5432 *** -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Aug 27 2011