Iterator, Enumerator, Abstraction Went Wrong

By Xah Lee. Date:

in programing, there's iterator and enumerator. (For example, Java, Python.) I really hate them. But, am thinking, just what is the reason i dislike them? I think the reason is, abstraction went wrong.

twitter tweet binge:

  1. xah's edu corner EXTEMPORE! the story of hatred of iterator and enumerator
  2. reading clojure doc about its data structure coll and seq. clojure is intertwined with java. It says iterator and iterable. but whats iterable? [see Why Clojure is Dense]
  3. well, java Iterable is just a Java “Interface”. turns out, java Collection is extended from Iterable.
  4. golly, i truly hate the iterator thing. iterator by the way, its the abstraction of i in for loop. instead of i++, you use it.next() instead.
  5. Then, there's enumerator. the diff of iterator and enumerator is that, iterator has method to let you delete elements
  6. iterator and enumerators, worst thing in programing. And, it is from shit the likes of Java and Python. It's a OOP thing. [see Why Python Suck]
  7. in programing, u have a list, u need to go thru it, then u access by index. that's concrete, basic, it's math! (or use map)
  8. but iterator is an “abstraction”! isn't it then, better?
  9. without abstraction, you have concrete, natural order, the physics, the math. Its written in stone by god, definite, concrete, absolute.
  10. but abstraction make things manageable, but, you begin to have the question of, what and how, who is right?
  11. with abstraction, correctness is lost. you have 1 billion ways to abstract things. stone can be river, 1+1 can be 3, and tao of mumbo-jumbo

See also: [Iterators: Signs of Weakness in Object-Oriented Languages By Henry G Baker. At http://home.pipeline.com/~hbaker1/Iterator.html 〔local copy Iterators_Signs_of_Weakness_in_Object_Oriented_Languages__Henry_G_Baker__1992.txt ]〕

Google Plus discussion https://plus.google.com/+XahLee/posts/R9WsnYaRpw7

If you have a question, put $5 at patreon and message me.