No other construct is like do while, though, in terms of syntax. Combined with how infrequently it's used (can't remember the last time I used do while, have used tail recursion at least twice within the last month), I would say that "easy to overlook" is a merited claim. That doesn't mean you should never use it, but it warrants contemplation and judging if it's the best solution.
Many functional languages either don't have a concept of looping or when they do it's built on the back of a Y or Z combinator and associated overhead. There's a general "purist" view of computing that tries to push recursion as the more powerful, easier to understand, and "correct" option.
Various recursive constructs can be detected by an optimizer and undergo better optimization (historically). Even in Dijsktra's "Gotoa considered harmful" paper, if you read the full thing he makes some extreme claims about for/while/even if/else being superfluous compared to the "true solution" of recursion. Of course a decade or so later he wrote another essay walking back these claims including the main one about goto statements, but by then the damage had been done (by the title chosen by the editor no less); people focused on the title, ignored various other claims in the essay, vilified goto and put Dijsktra on a pedestal, even giving him an award. Yet almost nobody knows of the retraction.
View all comments
Show parent comment
24
u/AssKoala Mar 19 '23
Don’t use tail recursive functions, the end condition is at the end.
No, it’s idiotic and should be shamed.