Don't most constructs evaluate into GOTO statements in assembly anyway? I don't understand all the GOTO hate, everyone implicitly uses it. I know it looks ugly in higher level code that has cleaner alternatives, but why all the self-righteousness against it?
Hey gaiz,
Y u 0ll youse dem hai leVEl 1angWich£s anyw@yz//??/ SALL coMpILeD DOun 2 AssEMBly, So Y n0T jUzT youse ThaT
Name:
Anonymous2010-07-14 16:54
Because the creators of some academic languages were against it. But at that time most people wrote in Cobol and Fortran where goto was another word for Pain, so their position is easy to understand.
Since then nobody bothered with a 'goto statements are good' paper, so it hangs around.
And Java was against it; The language of the bubble with all it's bubbly feelings.
Nobody thus far in this thread has a clue what they are talking about.
Name:
Anonymous2010-07-14 17:02
Since then nobody bothered with a 'goto statements are good' paper, so it hangs around.
Actually, I'm pretty certain that Knuth wrote a defence of it.
OP, your argument for goto is stupid. Abstraction is a good thing, and using higher level constructs makes your intent clearer. In general, unrestricted goto doesn't play well with other features of high-level languages and you could end up with a lot of uninitialised variables if you were to allow arbitrary jumps from one procedure to another. This is why even C restricts goto. If you are looking for a high level version of goto, you're probably going to want to read up on continuations. That said, goto is fine for some things, it's very useful to have in C when you want to jump to some cleanup code rather than faffing around with a couple extra ifs and flag variables.
If I may quote a fellow /prog/rider Goto Considered Harmful is the Strunk and White of programming papers.
Name:
Anonymous2010-07-14 17:29
The interesting thing about Dijkstra is how selectively people choose to apply his lessons. His arguments against break/continue stem from the same reasoning behind his argument against GOTO, but the latter is regarded as "Ivory Tower Bullshit", while the latter is so ingrained the minds of dullards as to be a reflex
>>11
Is that to say the former `latter' should rather be formulated as `former' while on the matter of the latter `latter' it should remain as it formerly was?
I suppose because modern compilers are more suited to code that doesn't frequently use goto statements? Perhaps they can optimise code better when we don't use goto.
That aside, there are too many stupid programmers (Stupid in the sense they don't think for themselves and conduct their own research) who just want the feeling of being 'right'
If you're comfortable writing goto statements, I don't see why you shouldn't.
If somebody is going to say 'you should not use goto', an equally valid argument would be 'You should not use the assignment operator'
The language is there to be used. Each construct in its own little way.
Have at it. Ignore the idiots.
I had someone telling me 'There is no valid reason to use continue.'
The same person did not know you could declare variables at the start of each code block. He is also a self-righteous prick who studied English too much to feel 'better' than other people.