2 ms·
There's definitely a significant confusion of terminology here. FTA: > The syntax itself is unimportant (some languages use foreach, others for i in l, etc…),
by gxti 16y ago
There's definitely a significant confusion of terminology here. FTA:
> The syntax itself is unimportant (some languages use foreach, others for i in l, etc…), what really matters is that iterators are gone.
The final example "for i in l" is Python. Python implements this construct precisely using iterators behind the scenes. Other languages are very similar, but Python in particular has a contract for an iterable object and that is how for loops work.
I think he meant to say "iterators should be invisible", not "iterators are an evil concept" but it's hard to be sure that he isn't just very confused as to what an iterator is in the general sense.
- eperfa 16y agoThat's what I wanted to note as well, that the "new" Java for loop also uses iterators - this syntax simply hides them. And this basically kills the main point of this article.. (But it is definitely easier on the eye)