For the past 40 years, there have been on-going debates in the programming world about the utility and usage of the keyword, Goto. While it’s been generally accepted that uncontrolled (no pun here) usage of Goto leads to unmanageable and spaghetti code, many, including Donald Knuth, believe that Goto is essential and when used with care will actually lead to clearer and more manageable code.
When designing the Small Basic language, I had the beginner programmer in mind. Some of them would graduate and move on to other more powerful languages, while some won’t. Those that won’t, will be content having learned a bit of programming and will remain hobbyists forever. The addition of concepts to the language had to be very carefully done between these two sets of audience.
For those that are taking the first step into the world of programming, there isn’t an easier and crisper way of teaching branching. Goto is such a clear and easy to explain this concept that I felt was necessary to include for a beginner.
Now, CS purists would argue that this is setting a bad trend for beginners that might become professional programmers later on and carry with them the bad practice. I believe that it is better to learn, understand and forget a bad habit than to be ignorant. Every structured programming language has some version of restricted Goto in the form of break, continue, etc. Understanding that fundamental concept is crucial for professional programmers. Besides, if they’re graduating from Small Basic, they’re going to run into unrestricted Goto in at least 7 out of the top 10 programming languages.
Coming back to the Small Basic audience, here’s my theory. Those that are content being hobbyist programmers in Small Basic, don’t really care about the nuances of using Goto. And those that graduate on to more advanced programming from Small Basic, would be able to appreciate why unrestricted Gotos are “bad.”
PS: Here’s a thread with Linus that I found was interesting.