[OT] Swift removing minor features to piss me off

Steven Schveighoffer via Digitalmars-d digitalmars-d at puremagic.com
Thu Apr 28 13:20:32 PDT 2016


On 4/28/16 4:01 PM, Seb wrote:
> On Thursday, 28 April 2016 at 18:53:21 UTC, Steven Schveighoffer wrote:
>> grrr... and they removed C-style for statements (i.e. for(;;))
>>
>> -Steve
>
> I agree with the other people on this list - cleaning up a language is
> great and should be done.
> `++` might be a bad example, but (empty) C-style for loops are!

Sorry, I should have been clearer. All C style for loops are losing 
support, not just empty ones.

The expressiveness of a C-style for-loop in terms of end condition and 
increment, combined with the ability to declare the loop variables in a 
new scope (BTW, swift doesn't allow arbitrary new scopes) is very nice 
for succinct expression of flow control.

 From the answers I'm getting on stack overflow, swift doesn't have very 
much in the way of higher-order functions for helping with this. That's 
what I'm looking for:

for x in someGenerator(0, endCondition: ..., increment: ...)

Right now, all they have is stride, which increments by a specific 
amount, with a specific end point defined as the same type as your 
variable. Anything else requires a while loop, which then of course 
loses the ability to declare loop variables.

I'm very much annoyed by the "you're doing it wrong" attitude when it 
comes to justifying the removal of these features. If you are going to 
remove a feature, there should be an equivalent way to do it.

-Steve


More information about the Digitalmars-d mailing list