3 ms·
Just my humble opinion but for loops seem unnecessary in high level languages (the kind with GC). Vectors make more sense to me on this level (APL, J, etc.).
by gwu78 13y ago
Just my humble opinion but for loops seem unnecessary in high level languages (the kind with GC). Vectors make more sense to me on this level (APL, J, etc.). I consider for loops as better fit for low level languages that don't automatically manage memory for the programmer (like C).
- jacques_chester 13y agoHistorical programming was done by advancing from memory location to memory location, one step at a time. The loop is a natural abstraction over this linearity, representing a jump from the end of a line of instructions back to the beginning. The problem being, as you point out, that it imposes a fixed order, regardless of whether the problem domain requires such an order. In database programming one of the biggest challenges for beginners is to stop thinking in terms of loops; to learn to "think in sets".
- gwu78 13y agoThanks for this. I'm relieved to know I'm not thinking the "wrong" way. :) But, honestly, I could not articulate the problem as you have. I wish I had your knowledge. The idea of a "jump" really captures it. setjmp. goto. It's navigating memory. And nothing more. I can visualize the problem, sort of - I just intuitively feel like sets, Lisp-like lists, and vector-based approaches, are the way to go in high level programming - but I do not know the right words to describe and argue my point. As such, I doubt I could convince many high level programmers to abandon the use of iterations in the code they write. Again, you have beautifully articulated what I could not. Cheers.
- jacques_chester 13y agoI did a little assembler in a course at university. When you write instructions that tell a CPU where to go next, it all becomes fairly visible. Even C blurs the model (which itself is a lie these days, but no matter). It didn't matter so much when C was created, because early C programmers were also assembler programmers. These days that's no longer true.