-1 as well. This Int extension is super-easy to implement if you want it. I 
don't remember ever using it in code outside tutorials. 

"What ought to be in the standard C++ library? One ideal is for a programmer to 
be able to find every interesting, significant, and reasonably general class, 
function, template, etc., in a library. However, the question here is not, 
"What ought to be in some library?" but "What ought to be in the standard 
library?" The answer "Everything!" is a reasonable first approximation to an 
answer to the former question but not the latter. A standard library is 
something every implementer must supply so that every programmer can rely on 
it" -- B. Strustroup

Would including this proposal in the Standard Library make a programmer's job 
easier? Probably, but not often
Does this proposal represent a fundamental element of daily development tasks? 
In my opinion, no
Does this proposal extend the core functionality of the language? No
Does this proposal deserve a place in an expended Standard Library? No.
-- E


> On Dec 18, 2015, at 4:18 PM, Kevin Ballard via swift-evolution 
> <[email protected]> wrote:
> 
> -1 here. It provides almost no utility outside of "hello world" style sample 
> code. Also this particular method is ambiguous, as people have already said 
> (the word "times" can mean multiplication just as much as it can mean 
> looping), and it also doesn't even make much sense when used with 
> non-literals, e.g. "foo.count.times" does not have the same "sounds like 
> English" behavior that "5.times" does. More generally, we shouldn't be adding 
> stuff to the standard library that doesn't provide any clear benefit, both 
> because it's API bloat and because everybody has to pay for the code size.
>  
> -Kevin Ballrd
>  
> On Fri, Dec 18, 2015, at 10:25 AM, Cihat Gündüz via swift-evolution wrote:
>> Dear Swift-Community,
>>  
>> I’d like to propose an addition of a useful method, especially for beginners 
>> that also makes Swift much more readable in some situations: The addition of 
>> a .times method to Integer type(s).
>>  
>> For example recently in one of my projects I wanted to test the scalability 
>> of an important piece of code and wrote this method:
>>  
>> func testPerfQualityInPercentWithoutQualityImprovements() {
>> self.measureBlock {
>> let expectedQuality = 33.33
>> 0.stride(to: 5_000, by: 1).forEach { _ in
>> XCTAssertEqualWithAccuracy(self.crossword.qualityInPercent, expectedQuality, 
>> accuracy: 0.1)   
>>             }   
>>         }
>>     }
>>  
>> As you can see what I basically wanted was to repeat the test some thousand 
>> times. I also like to use the Ruby language and one thing I love about it is 
>> that it has some really handy methods integrated to the language in 
>> situations like this which make the code very readable and therefore fun to 
>> use.
>>  
>> I’m an even bigger fan of Swift so I’d love to see such useful methods 
>> appear in Swift, too and this is the first I came across that I really 
>> missed. So I’m asking myself, what if I could write the same code above like 
>> this:
>>  
>> func testPerfQualityInPercentWithoutQualityImprovements() {
>> self.measureBlock {
>> let expectedQuality = 33.33
>> 5_000.times {
>> XCTAssertEqualWithAccuracy(self.crossword.qualityInPercent, expectedQuality, 
>> accuracy: 0.1)   
>>             }   
>>         }
>>     }
>>  
>> I think it could be added to the Swift standard library very easily (for 
>> example by using the .stride method like I used) without any side effects 
>> and has enough advantages to be part of Swift itself. What do you think?
>>  
>> I wish you all the best,
>> Cihat
>>  
>>  
>> P.S.: This is my very first mail in such a mailing list so I did everything 
>> correctly. ^.^
>>  
>> 
>> _______________________________________________
>> swift-evolution mailing list
>> [email protected] <mailto:[email protected]>
>> https://lists.swift.org/mailman/listinfo/swift-evolution 
>> <https://lists.swift.org/mailman/listinfo/swift-evolution>
>  
> 
> _______________________________________________
> 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