Re:Object Oriented Programming Oversold (2001)
by JustSomeNobody on Friday December 04, 2015 @08:16AM
(#10676115)
Funny how GOTO is bad, but "break"ing out of a FOR loop is acceptable. The break is a very specific case of a GOTO.
[ Parent
| on HN ]
Re:Object Oriented Programming Oversold (2001)
by jerf on Friday December 04, 2015 @08:53AM
(#10676276)
The essence of badness of GOTO is precisely that it is not "specific". When a higher level language restricts it, it is no longer the "bad goto" that structured programmers warned against. The problem isn't "transferring control flow", it was the ability to do it completely unrestricted.
Re:Object Oriented Programming Oversold (2001)
by mc808 on Friday December 04, 2015 @08:42AM
(#10676228)
Any kind of loop is just syntactic sugar over a goto. Having looping semantics in the language makes it clear when that particular pattern is being used, and it can prevent bugs that might pop up if everyone was writing their own ad hoc loops. Same thing with break. It makes the intent clear and makes it harder to accidentally stray from that intent.
Of course, there's a problem when sometimes you want to stray from the patterns encouraged by the language, but it doesn't provide adequate means to do so.
Re:Object Oriented Programming Oversold (2001)
by acveilleux on Friday December 04, 2015 @11:44AM
(#10677329)
Fortran IV would let you GO TO out of a DO loop into a whole different procedure's DO loop. (It didn't have FOR.)
But why limit yourself to GO TO to fixed places??? Fortran IV also let you GO TO an arbitrary statement that would only be chosen at run-time "assigned goto".
Fortran 77 still has that capability but you can limit it to specifically selected statements and it won't GO TO outside of the current unit (a concept Fortran IV lacked.)
Dijkstra's remarks were contemporary of Fortran IV.