<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Mar 8, 2016, at 11:13 AM, Maximilian Hünenberger via swift-evolution <<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div class="">Actually you cannot use the global stride function anymore.<br class=""></div></div></blockquote><div><br class=""></div><div><a href="https://github.com/apple/swift-evolution/blob/master/proposals/0006-apply-api-guidelines-to-the-standard-library.md" class="">https://github.com/apple/swift-evolution/blob/master/proposals/0006-apply-api-guidelines-to-the-standard-library.md</a></div><div><br class=""></div><div><pre style="box-sizing: border-box; overflow: auto; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; margin-top: 0px; margin-bottom: 0px; line-height: 1.45; padding: 16px; background-color: rgb(247, 247, 247); border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; word-wrap: normal; word-break: normal; color: rgb(51, 51, 51);" class=""> extension Strideable {
<span class="pl-md" style="box-sizing: border-box; background-color: rgb(255, 236, 236); color: rgb(189, 44, 0);">- public func stride(to end: Self, by stride: Stride) -> StrideTo<Self></span>
}
<span class="pl-mi1" style="box-sizing: border-box; background-color: rgb(234, 255, 234); color: rgb(85, 165, 50);">+public func stride<T : Strideable>(from start: T, to end: T, by stride: T.Stride) -> StrideTo<T></span>
extension Strideable {
<span class="pl-md" style="box-sizing: border-box; background-color: rgb(255, 236, 236); color: rgb(189, 44, 0);">- public func stride(through end: Self, by stride: Stride) -> StrideThrough<Self></span>
}
<span class="pl-mi1" style="box-sizing: border-box; background-color: rgb(234, 255, 234); color: rgb(85, 165, 50);">+public func stride<T : Strideable>(from start: T, through end: T, by stride: T.Stride) -> StrideThrough<T></span>
</pre><div class=""><span class="pl-mi1" style="box-sizing: border-box; background-color: rgb(234, 255, 234); color: rgb(85, 165, 50);"><br class=""></span></div></div><br class=""><blockquote type="cite" class=""><div class=""><div class="">I thought a method on "Range" which returns a stride would be easier to grasp:<br class=""><br class="">for x in 0.stride(to: 0.5, by: 0.03) { ... }<br class=""><br class="">// much faster to predict what is does even though it is less clear to a beginner<br class="">for x in (0 ... 0.5).by(0.03) { ... }<br class=""><br class="">- Maximilian<br class=""><br class=""><blockquote type="cite" class="">Am 08.03.2016 um 18:56 schrieb Антон Жилин <<a href="mailto:antonyzhilin@gmail.com" class="">antonyzhilin@gmail.com</a>>:<br class=""><br class="">It's already possible:<br class=""><br class="">for d in stride(from: 0, to: 5, by: 0.3) {<br class="">}<br class=""><br class="">Absolutely readable (despite all efforts to break it).<br class="">And I would passionately hate the special syntax for floating-point loops in Swift.<br class=""></blockquote>_______________________________________________<br class="">swift-evolution mailing list<br class=""><a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a><br class="">https://lists.swift.org/mailman/listinfo/swift-evolution<br class=""></div></div></blockquote></div><br class=""></body></html>