3 ms·
This article doesn't actually list any self-claimed "fundamental deficiencies". There's a reason that C (any many other languages) have been using pre and post
by jonny383 7y ago
This article doesn't actually list any self-claimed "fundamental deficiencies". There's a reason that C (any many other languages) have been using pre and post conditional loops for over fifty years - because it's what the machine actually does, and they are straight forward to follow.
The article mentions "A C programmer would write", and then shows two nested for loops. This is almost correct, but I think any good C programmer would write this once as a method or a macro, and then calling it is as simple x + y, without the snake-oil.
In either case, both are going to execute something like
.loop
CMP r0, r1
JNZ .end_of_loop
ADD r2, r1
; move some memory around
JMP .loop
.end_of_loop
;
And what does that look like... oh wow it's a loop.
The J language was written in 1990. It's now 2019. The language is just wrong.
- thenewnewguy 7y agoI have no real comment on C vs J in this instance, but I find it ironic these two statements appear in the same comment: > There's a reason that C (any many other languages) have been using pre and post conditional loops for over fifty years > The J language was written in 1990. It's now 2019. The language is just wrong. Is some practice being old good or bad?
- jonny383 7y agoIt's highlighting that C (and related languages) have been using loops for over fifty years, and that J has been around for 29 years with no marketshare. Therefore, it's safe to assume that A) C is correct, and people use loops for a reason, and B) J is wrong.
- inimino 7y ago> safe to assume Assuming that because something is popular it must be good is an example of assuming that things are as they should be, or deriving ought from is[1]. Assuming that because something is unpopular, it must be "wrong" is worse. Do you make all your technical decisions based on what is most popular? Do you always assume that whatever has not become popular must be "wrong"? [1]: https://en.wikipedia.org/wiki/Is%E2%80%93ought_problem https://en.wikipedia.org/wiki/Is%E2%80%93ought_problem
- jonny383 7y agoExcept I'm not assuming it's wrong because it's unpopular. Read the original comment, I clearly stated why it's wrong. My last comment was giving you a possible explanation as to why the witnessed behavior has occurred. Also, please show me one successful software package (and by successful, I mean largely consumed by consumers and a product leader) that does not use looping techniques. Like all technical decisions, they are made by using the most correct and appropriate choice. Which is why the industry has been using pre and post condition loops since the beginning. This "don't use loops" attitude is equivalent to trying to reinvent the wheel.
- thenewnewguy 7y ago> Except I'm not assuming it's wrong because it's unpopular. Read the original comment, I clearly stated why it's wrong. Except you clearly are. The only other reason stated in the original post seems to be "because it's similar to what the hardware does", which in my opinion is completely irrelevant - how does that in any way change how useful it is to program with? > Also, please show me one successful software package (and by successful, I mean largely consumed by consumers and a product leader) that does not use looping techniques. Must functional programming languages have no loop construct or using loops is heavily discouraged. > Like all technical decisions, they are made by using the most correct and appropriate choice. I don't believe that you're naive enough to think that one decision is correct in all scenarios, or that programming paradigms cannot evolve over time. > Which is why the industry has been using pre and post condition loops since the beginning. Congrats, we're back to "it's popular so it's good".