patternMinor
Why would you introduce the goto statement into a modern language?
Viewed 0 times
whytheintroduceyoustatementintolanguagewouldgotomodern
Problem
I just found out something really quite extraordinary. While looking through Stackoverflow, I came across a question about removing
It turns out I was sort of right. PHP introducted goto in version 5.3 which was release in 2009. PHP didn't start out with
Why on earth with all the horror stories we have from 40 years of bad programs written with
The php.net website even has this XKCD image suggesting no programmer should ever use
Question:
What possible reason from a technical point of view could there be for introducing a the goto feature, which I nievely thought had been vanquished from modern computer programming languages?
goto from a php function. PHP doesn't have goto I thought and looked it up on php.net. It turns out I was sort of right. PHP introducted goto in version 5.3 which was release in 2009. PHP didn't start out with
gotoit actually introduced it into the language in 2009!Why on earth with all the horror stories we have from 40 years of bad programs written with
goto in other languages would php actually decide to introduce it?The php.net website even has this XKCD image suggesting no programmer should ever use
goto.Question:
What possible reason from a technical point of view could there be for introducing a the goto feature, which I nievely thought had been vanquished from modern computer programming languages?
Solution
There are two kinds of programmers: Those who for whatever reason never, ever use goto, and go to any lengths to avoid it, and those who use goto in one of the very rare situations where it is the best solution. (Someone said here in a comment that goto could be misused and programmers would find ways to misuse it - but those people are not programmers).
It makes sense to add "goto" to a language that doesn't have it if there is evidence that there are situations where it improves the code, and if it is not too difficult to implement. So I would assume that there was such evidence.
It makes sense to add "goto" to a language that doesn't have it if there is evidence that there are situations where it improves the code, and if it is not too difficult to implement. So I would assume that there was such evidence.
Context
StackExchange Computer Science Q#48050, answer score: 9
Revisions (0)
No revisions yet.