Does D have too many features?
Era Scarecrow
rtcvb32 at yahoo.com
Sun Apr 29 16:54:21 PDT 2012
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.
More information about the Digitalmars-d
mailing list