Re: with entry and goto statement
- Posted by jaygade Dec 31, 2010
- 1658 views
I know it is the current fashion amongst all developers to bash the GOTO statement. It is undesirable to do so.
Let me be precise. There is unjustified abhorrence of GOTO and many other features which are direct descendants of CPU behavior (as seen in Assembler). Jump Relative, Jump Conditional and Jump Absolute are the cornerstone of writing in Assembler. Their cousins, Call Relative, Call Absolute and Call Conditional are seen in the GOSUB statement.
Because we aren't programming in machine language or assembler. We're programming at a higher level with better abstractions, abstractions which should hopefully be clearer.
It is a matter of great surprise that we accept all the implied GOTOs within IF-THEN-ELSE and even Exits from this and DO-WHILE loops and frown upon GPTOs created by the program writer.
Which is the abstraction. You know exactly where the program will branch and you do not end up with spaghetti code.
Back when I first started programming in BASIC, GOTO and GOSUB were all there was. There wasn't even an "ELSE" clause. And we had to use line numbers instead of labels, which are themselves an abstraction.
Funnily when we write an Application for the end user we give the End User ALL the facility of GOTO and GOSUB, by allowing him to branch out to any part of application and return or not return at the user's own choosing! It seems that Application users are very comfortable working with these facilities which the compiler writer is denying to the sophisticated Application developer.
Okay. And? That's like apples and oranges. Or apples and bowling balls, rather.