Comments on: Eliminating the C For Loop Is Not Bad for Swift. https://www.andyibanez.com/why-eliminating-c-style-for-loops-is-not-a-bad-thing-for-swift/ Teaching you cool stuff since 2012. Fri, 21 Jun 2019 10:32:11 +0000 hourly 1 https://wordpress.org/?v=4.9.10 By: Bojan Marković https://www.andyibanez.com/why-eliminating-c-style-for-loops-is-not-a-bad-thing-for-swift/#comment-1196 Fri, 25 Mar 2016 11:33:54 +0000 https://www.andyibanez.com/?p=417#comment-1196 Tail recursion is certainly not shorter in lines of code (a non-quality for code you seemed to advocate in your map examples), and furthermore, it’s rarely more readable than for ;; loop or any kind of looping, even in school-level examples. It’s universally more complex to read and understand, as well as needlessly data-intensive.

Non-tail recursion on the other hand doesn’t need sloppy programing to stack overflow or hog memory, all it needs is a sufficiently large iterator.

]]>
By: Andrew https://www.andyibanez.com/why-eliminating-c-style-for-loops-is-not-a-bad-thing-for-swift/#comment-1192 Thu, 24 Mar 2016 17:00:32 +0000 https://www.andyibanez.com/?p=417#comment-1192 You are missing a use case for loops. I want to iterate over part of the collection. How do I do that without using while?

]]>
By: Andrés Ibañez https://www.andyibanez.com/why-eliminating-c-style-for-loops-is-not-a-bad-thing-for-swift/#comment-1079 Sun, 20 Dec 2015 17:15:56 +0000 https://www.andyibanez.com/?p=417#comment-1079 Recursion only crashes if you don’t know how to do it properly. There’s also the concept of Tail Recursion which prevents the scenario of a program crashing due to a stack overflow.

]]>
By: recursion_allergen https://www.andyibanez.com/why-eliminating-c-style-for-loops-is-not-a-bad-thing-for-swift/#comment-1078 Sun, 20 Dec 2015 12:34:44 +0000 https://www.andyibanez.com/?p=417#comment-1078 Recursion… Seriously. Recursion is rarely the best way except if you are intenting to crash a system. Backward compatibility code is more convenient than some new programming paradigms.

]]>