4 ms·
Not really, iteration requires the existence of interfaces, requiring two methods (or one, if optionals are supported). Iterator semantics are orthogonal to mem
by hctaw 6y ago
Not really, iteration requires the existence of interfaces, requiring two methods (or one, if optionals are supported). Iterator semantics are orthogonal to memory management.
The transformation into a while loop is a handful of lines of code (unless your implementation language sucks). It's not difficult for simple iterators (but can get dense for more generic constructs like generators).