Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

foreache

Name: Anonymous 2014-01-20 18:58

what is you're opinion on foreache loops?

i don't like em cuz they ache in the fore

Name: Anonymous 2014-01-21 20:57

>>2

not even close. what we are really talking about is iteration by enumeration (i.e. internal iteration) vs iteration by stream (i.e. external iteration). the two are provably isomorphic, but differ a lot in semantics and implementation

internal iteration is imo the superior choice - it is easier to read, easier to reason about (for data structures that aren't lists), requires less state (i.e. obtaining and maintaining an iterator, deallocating resources), and has predictable resource utilization (when iterating over items requires file/db access)

it is a lot harder (but not impossible) to stop iteration before exhaustion and do things like interleave iterators, but i find the other stuff outweighs this

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List