View Single Post
Old 10 August 2015, 18:53   #208
Registered User

Megol's Avatar
Join Date: May 2014
Location: inside the emulator
Posts: 209
Originally Posted by Dunny View Post
Gonna have to jump in here and say that you've totally missed the point of BASIC. It was never intended to be used for production code, it was never intended to be as fast as a good compiler and it doesn't need to have any of the more powerful features that the more professional languages have.
Really? I have an old minicomputer designed to only run BASIC programs and I assure you it was used for serious production code including industrial control!

It was intended to get the absolute beginner into programming, with an eye to moving up to more complex systems later when they reached proficiency.

Many people make the mistake of saying things like "C is perfect for the beginner" or "Assembly is so simple anyone could pick it up" or other such phrases - when what they're actually saying is that because they're proficient in such a language they believe that someone who has never even looked at code before could do as well as they have.
Note that I didn't say that. I said that one can't call BASIC a good language for a multitude of reasons that I listed. That doesn't mean a certain BASIC _dialect_ can be a good language - which leads to the problem of extensions not following a standard.

That's not to say that a beginner couldn't start off with C or Python or Perl or whatever - they can. But BASIC makes it easier, by a huge margin.

Line numbers are not there to "enforce labels" - they are there to reinforce how a computer does its job - logically, one instruction at a time in sequence. The list of lines, being numbered and in sequence, helps the beginner grasp what order things are going to be done in. This is preferable to C/Pascal et al because they often do things in a non-obvious order what with having entry points halfway through a source file or whatever.
Nope - line numbers are there because BASIC was designed for systems without complex editors. The ordered sequence of numbered lines isn't the same as the execution order for all but trivial code.

But still the line numbers mean that one can't know if a certain code block is the target of a goto/gosub/restore.

Limited datatypes is a conscious decision to simplify things - when you don't even know what a variable is you certainly can't be worrying about how many bytes it takes, what the range is, whether or not it's signed... You have enough on your plate as it is when some letters can be numbers and some can be strings of other letters!
This means one have to recreate datatypes oneself by wrapping stuff in other things (often strings IME) which is a PITA and not even possible for many tasks.

If one uses BASIC to learn the absolute basics of programming then yes, I can see your point. But that wasn't the point of what I replied to.

Limited variable naming tends to be a limitation of the BASIC's environment such as memory space available etc. Even the old 8bits allowed you to name things with long names, even if some of them restricted string variable names to one letter and a $ character suffix! These days though, I don't know of many BASICs at all that restrict variable name lengths.
Even primitive Forth systems used a better (but still shitty) naming system - one could name words (variables, functions etc. are all words in Forth) whatever one want in a restricted character set but the system used the first n letters + total length for matching.

In BASIC one doesn't even have the luxury of that, IF the BASIC system supports semi-long names (many doesn't) then all but the first character is ignored and the length of the name is too. Total failure.

Static allocation isn't really a problem at the beginner level, and nor is support for structured programming or code flow. It's enough to know that you can use GOTO to jump around, GOSUB to enter a subroutine - moving onto procedures and function definitions is quite advanced when you're still getting to grips with the fact that your code can branch if a decision is made
Teaching the students to write spaghetti code with global variables for parameter passing.
The only "standard" structured element in BASIC is DEF FN and even that isn't a given (some BASICs doesn't implement it, some have serious limitations).

Static allocation makes a lot of things essentially impossible to program in BASIC.

There are many BASICs out there now (and have been since the days of the Amiga and before even that) which promise that the user can use them to write complex applications and boast many of the features of their lower-level peers, but they themselves are to blame for many of BASIC's failings - they don't encourage a user to move on and learn a better system.

If a user has learnt sufficient BASIC to be able to write complex systems and games then they really shouldn't be using a BASIC to do it - they're good enough coders to be able to start with something like C or learn Asm. BASIC is for beginners, and for its part in their development it does its job admirably.

TL;DR - BASIC is great for teaching people to code from the ground up, but no more than that; you're not meant to stay with BASIC forever.

Well there are a number of good BASIC extensions that really (IMHO) can be considered less structured versions of Pascal or COMAL. But those are mostly completely different languages with a common base called BASIC.
But still the point of my post was that BASIC have problems on many levels and isn't a good alternative for most programming tasks. Unless it is the only language available like in my Wang 2200 beast. :/
Megol is offline  
Page generated in 0.06226 seconds with 9 queries