4 ms·
Genuine question: what do you do when you want to implement your own loop mechanism, iterator, array type, or whatever?
by btrask 10y ago
Genuine question: what do you do when you want to implement your own loop mechanism, iterator, array type, or whatever?
- cokernel_hacker 10y agoIt is the job of the language to ensure that language primitives are reusable and composable. I think this would apply to whatever mechanism is designed to describe a loop's iteration space.
- Sean1708 10y agoMost languages use some sort of interface whereby if you implement certain methods for a type then that type can be iterated over using a for loop.