4 ms·
The Joke Is On Us: How Ruby 1.9 Supports the Goto Statement
- NameNickHN 15y agoAll those different languages might support the goto statement, but what programmer in his right mind would dare to use it? http://xkcd.com/292/ http://xkcd.com/292/
- batista 15y agoI can tell you what programmer would NOT dare use it: a programmer that doesn't bother understand programming and when each feature can be used, and instead relies on conventional wisdom and old wives tales (sometimes called "voodoo programming") to tell him what is acceptable and what is not. Notice how the guys repeating the "goto is evil" mantra, like they guy in this thread: http://kerneltrap.org/node/553/2131 http://kerneltrap.org/node/553/2131 are young as it's highly improbable that they ever had to deal with actual goto spaghetti code. So they just repeat what they heard somewhere. This guy, e.g writes: However, I have always been taught, and have always believed that "goto"s are inherently evil. They are the creators of spaghetti code (you start reading through the code to understand it (months or years after its written), and suddenly you jump to somewhere totally unrelated, and then jump somewhere else backwards, and it all gets ugly quickly). This makes later debugging of code total hell. Which, as I read it is clear that he has never actually witnessed in real life the kind of code he worries about ("I have always been told", "I have always believed" etc != "I know from experience"). I consider this more embarrassing than using goto.
- NameNickHN 15y agoThere are things in life that one doesn't has to try in order to know that they are bad.
- batista 15y agoYes. But there is nothing like those in programming, math, painting, etc. And even if it where, goto wouldn't be one of them.
- comice 15y ago"The goto statement is one of the most infamous and troublesome features of old, archaic languages like Fortran." "It allowed programmers to quickly create spaghetti code that was confusing and impossible to understand" C still supports goto, and it does have its place. It can actually make code more readable. But Linus Torvalds, Robert Love, Rik van Riel and many others make the point much better than I ever can. Argue with them if you like: http://kerneltrap.org/node/553/2131 http://kerneltrap.org/node/553/2131