On 30-04-2012 01:54, Era Scarecrow wrote:
On Sunday, 29 April 2012 at 15:07:26 UTC, David Nadlinger wrote:
On Sunday, 29 April 2012 at 14:40:38 UTC, Jacob Carlborg wrote:
foreach ([1, 2, 3, 4], (i) { writeln(i); });

The above already works today. If we can a bit syntax sugar for
delegates and inlinable delegates we could have this:

foreach ([1, 2, 3, 4] ; i) {
writeln(i);
}

We'd still need a solution for continue and break, though.

A thought coming to mind regarding this, is a special exception. If the
compiler recognizes it's part of a foreach (or other loop) then continue
gets converted to return, and and break throws an exception (caught by
the foreach of course)

But that involves more compiler magic.


And forced EH which is unacceptable in e.g. a kernel.

--
- Alex

Reply via email to