[OT] Swift removing minor features to piss me off

Seb via Digitalmars-d digitalmars-d at puremagic.com
Thu Apr 28 23:22:25 PDT 2016


On Friday, 29 April 2016 at 05:34:21 UTC, ag0aep6g wrote:
> On 29.04.2016 06:51, default0 wrote:
>> for(int i = 0; i < 5; ++i)
>>      arr1[i] += arr2[i];
>>
>> And
>>
>> for(int i = 0; i < 5; ++i)
>>      arr[i].SetIndex(i);
>>
>> My guess, not knowing Swift, is that you will now implement 
>> these in a
>> more verbose, harder to read way using while or use some 
>> concept similar
>> to C#s LINQ or Ds ranges to somehow automatically apply this 
>> type of
>> functionality.
>> Both seem way more awkward than a normal for-loop.
>
> I think it's fine with a D range: `foreach (i; iota(0, 5))` is 
> less noisy than the `for` variant.

`foreach (i; 0..5)` seems to cover 95% of my for uses and it 
looks a lot cleaner. I am actually pretty happy that D has this!


More information about the Digitalmars-d mailing list