News for hackers. Stuff that matters.
Re:Philosophy and "for" loops — more from Go and Rust by gwu78 on Thursday July 11, 2013 @07:13PM (#6029901)
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).
Re:Philosophy and "for" loops — more from Go and Rust by jacques_chester on Thursday July 11, 2013 @10:09PM (#6030485)
Historical 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".

Re:Philosophy and "for" loops — more from Go and Rust by gwu78 on Thursday July 11, 2013 @10:35PM (#6030579)
Thanks 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.

Re:Philosophy and "for" loops — more from Go and Rust by jacques_chester on Friday July 12, 2013 @04:45AM (#6031624)
I 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.