3 ms·
It's because "goto considered harmful" is a catchy meme, and also many older programmers have had understandably bad experiences with code that abuses goto.
by enneff 13y ago
It's because "goto considered harmful" is a catchy meme, and also many older programmers have had understandably bad experiences with code that abuses goto.
- beagle3 13y agoI suspect the percentage of programmers who actually had bad experience with goto is now vanishingly small. I'm not downplaying the harm that goto can cause - but to have experienced it, you have had to experience old basic, fortran 77 or COBOL before learning C or Java. That probably describes 0.1% of people doing programming. Maybe less. The averse reaction to goto is conditioned response, not learned experience.
- RBerenguel 13y agoI learnt programming with a book named "Basic para niños" (Basic for kids when I was ~7-8, around 23 years ago) and with the programmers manual for GW-Basic. So goto was an inherent part of it, but as soon as I learnt other languages goto lost a big part of its significance. I read a lot of code full of gotos (back in my Basic days) but afterwards only the occasional goto would pop up. When I learnt C at my university for numerical stuff, we weren't taught goto existed (I found it out when reading K&R 2-3 years later, when I wanted to get a better understanding of it.) Goto is awesome in a lot of cases (where something alike to break label; is not available), but as you say, the conditioned response is "goto is bad." And it's pity, because nothing is inherently bad, most often it's just the user at fault.
- beagle3 13y agoWhere was that? In 1990 in the US and UK and France (possibly other places - that's where I'm aware of), Basic was already on the way out - and that was the "good" basics like BBC Basic (with procedures, local variables, WHILE/WEND, REPEAT/UNTIL, named labels, proper error control with ON ERROR - I think of these, GW Basic only had "on error"). It was already Pascal in academia and "regular" insdustry, C in low-level stuff and FORTRAN 77 in science stuff. Of course, there was still legacy Basic and legacy COBOL, and you were much more likely to run into a historical mess of GOTOs. But still, it was already past the Acceptable Spaghetti era.