Hacker News new | past | comments | ask | show | jobs | submit login

I think you are arguing that iterators are "primarily" for iteration. But in C++ they really are like an abstraction over C pointers. For example, you can hold a std::list::iterator, and use it to efficiently delete from a linked list, without ever iterating.

Sometimes C pointers are used for iteration, but I would not say that is their primary purpose.




> I think you are arguing that iterators are "primarily" for iteration

I really wonder why people put up with something named this way then. "That fool thinks iterators are for iteration!"

Clarity of abstraction and good naming are important, unless the practitioners are masochists.


Cursor would be a better name probably, but I wouldn't say the name is misleading, as iteration is an important use case.




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: