Summary of feedback

Cons
Block based API prevents return/break/continue
Can be implemented by an extension without language changes
Vaguely confusable with multiplication

Pros
Is easier for new learners
Removes ambiguity of ..< vs ... (again mostly new learners)
shorter than existing syntax

Alternatives
for _ in 0..< 5_000 (current solution)
repeat 5_000 (alternative syntax)
for 5_000

My $.02

If we are going to introduce a new "something" it should either provide a 
feature that is currently impossible or it should provide a significantly 
better way to do something that can already be done. With that as my metric I 
find 5_000.times to be moderately better at best and does not meet my standard 
for inclusion.

Andrew Hoos


> On Dec 19, 2015, at 16:35, Brent Royal-Gordon via swift-evolution 
> <[email protected]> wrote:
> 
>> I do have an honest question that comes from ignorance rather than malice: 
>> has anyone actually used .times in ruby outside of the context of learning 
>> or testing?
> 
> I've seen it used to retry a failing operation a certain number of times:
> 
>       5.times do
>               return true if do_network_call
>               sleep 5
>       end
>       raise NetworkCallFailedError
> 
> Of course, that requires you to be able to return out of the surrounding 
> function from the `times` loop, which you can do in Ruby but not in Swift.
> 
> -- 
> Brent Royal-Gordon
> Architechies
> 
> _______________________________________________
> swift-evolution mailing list
> [email protected]
> https://lists.swift.org/mailman/listinfo/swift-evolution

_______________________________________________
swift-evolution mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-evolution

Reply via email to