4 ms·
I wouldn't implement goto in a new programming language. Not because it's never useful, but because it's only very rarely needed, and it's very existence means
by nawitus 12y ago
I wouldn't implement goto in a new programming language. Not because it's never useful, but because it's only very rarely needed, and it's very existence means that it's easy to misuse it. Programming languages should be minimalistic and rarely needed features should be cut away. I've read similar reasoning from Eric Lippert when he was still designing C# features (which is not the best example, as C# is rather bloated).
Of course, the "should we use goto" question is different from "should we implement goto in new programming languages".
- kstenerud 12y ago`it's very existence means that it's easy to misuse it` However, few people actually do: https://peerj.com/preprints/826v1 https://peerj.com/preprints/826v1
- nawitus 12y agoIn C at least. Anyway, that's probably due to the significant amount of discussion about goto. Perhaps "ironically" goto is a good feature only because it's criticized enough so that it's typically used correctly?
- _lce0 12y ago> Perhaps "ironically" goto is a good feature only because it's criticized enough so that it's typically used correctly? there are no good/bad features, there are only good/bad programmers.
- Veedrac 12y agoTo play devil's advocate, the very example in the article is a misuse. Not only is a difference of less than 1% in code speed insignificant (local timings), but a do...while loop displays the intent (looping) better.
- xamuel 12y ago>Programming languages should be minimalistic If we follow this to its extreme, everyone should switch to Brainfuck. The complexity contributed by a feature is partly a function of how unintuitive it is. "Goto" is so intuitive that it's essentially free, in the sense that it doesn't really increase the cognitive burden of the language. (If misused, it can greatly increase the cognitive burden of individual programs in the language, of course.)
- nawitus 12y ago>If we follow this to its extreme, everyone should switch to Brainfuck. Yeah, we shouldn't.