Loops must die!



Marco Emrich’s talk at OSCON 2019.

A good developer will always try to enlarge their toolbox and get to know new or better tools for specific situations, but it’s also helpful to free yourself from mental ballast now and then to get rid of one or another stone wedge. For most developers a classic loop is such a stone wedge.

Marco Emrich dives into this not entirely uncontroversial assertion from different angles, including the problems and application scenarios for loops. He asks if there are alternatives, what the advantages are (spoiler: high-order functions like map and reduce, recursion, etc.), and if there are any situations where the classic loop is still preferable. You’ll then examine loops and the alternatives in various languages (e.g., JavaScript, Java, Haskell, C#, Ruby, and PHP).

source