BASIC was not just a programming language(gcher.com) |
BASIC was not just a programming language(gcher.com) |
I genuinely feel that Dijkstra’s famous rant about BASIC had a big hand in killing it off. I don’t think it was the intention but it created so much bias against BASIC. If you created something in basic, or even suggested using it, someone would post that quote in the usenet thread. Like Godwin’s Law.
It’s a shame, because it was so accessible, not just because it was right there but also because it does make it very easy for beginners to understand programming in a way that structured programming doesn’t.
If there’s one language guilty of causing brain damage it’s surely JavaScript.
Seems doubtful? In the essay where his famous comment on BASIC appeared ("How Do We Tell Truths That Might Hurt?" https://www.cs.utexas.edu/users/EWD/ewd04xx/EWD498.PDF), Dijkstra took a snarky swipe at many of the major languages of the time: PL/I, COBOL, FORTRAN, APL and COBOL and FORTRAN at least are still around. It was just what in modern parlance would be called a shitpost (no, really, read it), albeit more articulate than most.
(I joke that Real Programmers™ get their shitposts immortalized in ACM publications: https://dl.acm.org/doi/10.1145/947923.947924 )
Basic evolved to have blocks, scopes, procedures, and functions. Visual Basic is probably closer to Algol or Pascal than to the original GOTO-only BASIC which Dijkstra was complainig about. VB.Net has the same semantics as C# which means it is one of the most powerful languages available. But it is not really a good beginner language anymore.
[1] https://www.cs.utexas.edu/users/EWD/transcriptions/EWD04xx/E... - 18th June 1975
As someone whose first exposure to computer programming was BASIC on an Apple II in the early 1980s when I was around 8-9 years old and who later went on to learn multiple other programming languages, I always wondered what about BASIC inspired that particular sentiment. Was it the line numbers? The GOTO statement? The use of "GOSUB.....RETURN" rather than explicit functions?
>If there’s one language guilty of causing brain damage it’s surely JavaScript.
I'm not sure about that. The only language that I felt led to bad things from developers was perl, mainly because it was so difficult to read later.
In its detractors, you mean? (This was a perfectly reasonable comment until you got irrational at the end; even people who understand Dijkstra's comment but feel that we lost something should be extremely pleased that the thing that took BASIC's place is a language that supports structured programming and is otherwise as nice as JS.)
Hahaha. I largely consider JavaScript to be the new BASIC - not because you can learn how to do some fun or useful things with it in an afternoon, but because it is ubiquitous. Web browsers are everywhere, and nearly all of them have JavaScript. A lot of JavaScript's quirkiness and inconvenience seems to derive from its web browser/DOM environment. (It's probably still easier to write GUI apps in Visual BASIC.)
Also: I'm still disappointed that Python 3 removed the print statement, so that
print "hello, world!"
is no longer a program that works both in BASIC and in Python.Why JS and not PHP?
It also never killed it off, and it wasn't a big rant - just a single sentence - either. He also ranted over a few other languages in the same list.
PHP, like JS, sees a lot of unstructured code relying on random global variables in the wild as well :)
JavaScript is way more powerful than Basic on any of those 4 platforms. The canvas 2D API is way more capable and easy than what came with those systems. Even getting something like
<input type="text">
Was 50-150 lines of code in BASIC, by which I mean a text input line with a cursor and editing and not just BASIC's "INPUT" command which provided nearly zero editing support.Libraries like pixi.js or three.js or p5.js etc make it trivial to get fancy graphics on the screen. Making something you can share it with your friends or the entire world with a link, even if they don't own the same type of machine running the same OS. Host them on codepen, jsfiddle, github pages, all free.
I loved my experience with Basic and those old machines but I wouldn't force my kids to learn that way.
If a browser had to be implemented in 16 KB of binary, and use at most 48kB of RAM when running, many of the APIs you enjoy having would not be there. And it's not even about features of the language itself.
There was a time when you could have both - the language and the functionalities of a browser - IE supported VBScript in script tags:
<SCRIPT LANGUAGE="VBScript">
<!--
Sub Button1_OnClick
MsgBox "Hello world"
End Sub
-->
</SCRIPT>JavaScript is ubiquitous (which is why I consider it to be BASIC's de facto heir), but it's (much) less accessible than BASIC was.
And as good BBSes, user groups, and print magazines may have been for sharing C64 programs, the internet is pretty great for sharing JavaScript programs with people all over the world.
It's not the same, it's better.
There are so many layers between me and the hardware today that I feel like I float above it, and that I just have to trust it all intrinsically.
I don't, really, and it constantly gives me this feeling of almost falling.
This is the first time I heard of such a BASIC command, even though I grew up learning to program on a Sinclair ZX Spectrum.
Which of the home computers of the time had this command? Would it renumber in multiples of 10?
Members of the Dartmouth football team wrote a football simulation for Dartmouth BASIC back then; a port of this game for microcomputer BASICs is available in David H. Ahl's BASIC Computer Games as "FTBALL".
Wow.
Writing this words now, I don't know that I ever looked into what happened if you called GOSUB from a GOSUB routine, or how deep you could call. That would imply some sort of stack!
[edited to correct a typo]
10 level=1
20 GOSUB 40
30 END
40 PRINT"Current level: ",level
50 level=level+1
60 GOSUB 40
Prints a "Memory full in 50" after printing level 84. At first I thought it dedicated about 168 bytes for GOSUB stack, but the "memory full" happens on the level assignment.You can erase this stack explicitly by calling `CLEAR` (will also close open files and clear ALL variables).
> I don't know that I ever looked into what happened if you called GOSUB from a GOSUB routine
I want to say all BASICs had a stack (not sure about Apple Integer BASIC), or used the CPU stack. Expression evaluation also used it, and if you overflowed it you would get a ?FORMULA TOO COMPLEX error.
Anyway it's been a very long time since I used my raspberry pi, maybe this is now a feature.
https://www.riscosopen.org/content/downloads/raspberry-pi
They used to offer a BBC BASIC-only image called RISC OS Pico, which you can still find on the Internet Archive and should still work on older Pis:
https://web.archive.org/web/20181109020203/https://www.risco...
https://web.archive.org/web/20181109020203/http://packages.r...
--Edsger Dijkstra (1975)
I hope Dijkstra was being humorous. I used to wear his quote as a badge of honor.
"The tools we use have a profound influence on our thinking habits, and, therefore, our thinking ability."
I went from Basic to Pascal to C/C++ to Java to Python which bear more than a passing resemblance to one another. Am I habituated to overlook or discount other programming paradigms, like Lisp, Prolog, and Forth? I can tell you with certainty that I once was. My view was even more limited then than it is now, and yet at that time I thought I knew everything worth knowing.
The optional second argument would change the step size. The default was 10.
https://archive.org/details/a8b_Atari_800_Basic_v1.0_1981_Mi...
(to be fair, I think media corruption was more common back then, so boot-time file system checks and other sanity checks may have been what kept mainstream boots slower?)
There are exceptions to this rule: Sharp was known for their concept of "clean computers" (MZ series and X1), which came only with a simple monitor in ROM, while at the same time featuring just a cassette drive to load a BASIC interpreter (of which there were several flavors) from.
Literally, completely wrong.
More like less than a second after power-up to reach full usefulness at the command line.
These type computers did not need to actually boot their OS from a "peripheral" storage device.
They did not "boot" at all, they just ran the built-in OS/BASIC straight from where it was contained on ROM.
This was like the C64 which had its BASIC in internal ROM too.
With the early Atari's the internal ROM was more like a skeletal BIOS which ran whichever ROM cartridge you had in the game slot, whether it was a commercial game or not. And the Atari BASIC command line was only available if you had the BASIC cartridge inserted where a game would otherwise be.
RAM and storage were almost all yours.
...that's pretty much what "booting" means though. Even on those hardwired machines with operating system and BASIC interpreter in ROM, the hardware still needs to be brought into a defined state (IO, timer, audio and video chips need to be initialized, interrupts need to be setup, the operating system needs to initialize portions of RAM used for keeping variable state, also checking what peripheral devices and hardware modules are connected and initializing those, and so on and on...).
Booting doesn't require loading an os.
And if we include dos as an os, I'm not even sure of the conceptual difference between booting basic and booting dos.
The only major thing is device discovery and setup etc.
But even the 8 bits had to start up the screen output routines, so I would still classify that as 'booting'
But things may still change for the worse with that process of Scala-ification they are doing to PHP 8.x.
But it wasn't, it was just so easy to write badly early.
spoilers: There was no GOSUB in the version Dijkstra commented on. There was not even anything else to put in an "THEN" statement than a line number ("THEN 210" is the code). If you wanted to store user's name in your variable, "n" was the name to go with, because "name" was not supported. And so on... :)
Oh, and the line numbers were a necessity.
However, this line in your article would seem to indicate that GOSUB was available in the original version:
>The first version of the language was extremely limited, compared to any later popular version of BASIC. The only supported keywords apart from math functions were: LET, PRINT, END, FOR...NEXT, GOTO, GOSUB...RETURN, IF...THEN, DEF, READ, DATA, DIM, and REM.
VS Today wheer there are 1000s of websites that will teach you JavaScript and 1000s of free video classes and hundreds of thousands of free examples. JavaScript is several orders of magnitude more discovable than basic ever was
> AUTO10,1000
Silly
> _
The first parameter is weird, though: if you put in a number that's too large, the system reports a syntax error. 10000,255 works, but 50000,255 doesn't.
It's AMSDOS that provided hardware and disk handling, while BASIC could focus on running BASIC code. I think even the graphics routines (like setting a pixel) may have been implemented in AMSDOS, but not sure - and the line between two is blurry from user perspective. While those are two ROMs by two companies, they were developed in cooperation.
Since I just have the CPC Intern book lying around on my desk :)
The graphics routines were not part of AMSDOS, but of the GRA ROM pack (the CPC OS was modularized into "packs" each coming with a standardized interface jump table: Kernel (KL), Machine Pack (MP), Jump/Restore (JRE), Screen Pack (SCR), Text Screen (TXT), Graphics Screen (GRA), Keyboard Manager (KM), Sound Manager (SOUND), Cassette Manager (CAS), Screen Editor (EDIT).
The book doesn't tell much about the AMSDOS ROM, only that the 16 KByte ROM is split into 8 KByte for the actual AMSDOS, and the other 8 KByte are used for a part of the LOGO interpreter coming with CP/M 2.2
PS: also important to note that not all CPC models came with the AMSDOS ROM or builtin floppy drive, so the actual operating system and BASIC interpreter couldn't be built on top of AMSDOS.
Right, technically correct! On the other hand, the command to return to BASIC from CP/M was "AMSDOS" - the distinction to be seen by the user was to be AMSDOS vs CP/M as two operating systems.
Btw. which book describes these internals? ;>>>
Good idea. Legitimate request.
As it was understood with 1980's microprocessor desktops, booting was a more complex stepwise startup procedure than simply running the fully-functional factory OS or video game instantly from ROM.
Booting required a storage medium other than memory (such as punch cards, paper tape, magnetic tape, disks) to peripherally store the actual OS or shell which had to be loaded into memory in a "bootstrapping" process before it could run. RAM was used for the working OS rather than ROM, so process control was "booted" to RAM right after the ROM code merely establishes a hardware interface and serves as an Initial Program Loader.
Nobody ever talked about "booting" a C64 or Atari400 if all you were going to run was the factory BASIC command line.
Which was the vast majority of non-gaming use. Far fewer users had external storage to begin with and almost all of them used it only for storing & loading their own code or non-ROM game files [0].
Only the uncommonly advanced operators (not me) were actually using their external storage to "boot" to a different OS or programming language, but it was necessary if you were going to use something like Pascal [1]:
"Kyan PASCAL consists of two programs: the editor program (ED) and the compiler/assembler program (PC). When your Apple (ATARI) is booted (to boot the ATARI, push the <OPTION> key during power-up) with a KyanPASCAL disk in the drive the following will be displayed:
KYANPASCAL VERSION 1.0 COPYRIGHT
1985 BY KYANSOFTWARE
1850 UNION STREET, SUITE 183
SAN FRANCISCO, CA 94123
>"
IOW when you didn't push the <OPTION> key during power up (which very few users ever pushed) you weren't booting the Atari, but merely powering up and running the game or command line directly from ROM.
It was not like an x86 PC which used its ROM firmware mainly as an Initial Program Loader, otherwise known as a bootloader, to load your desired OS from storage into RAM, giving you access to a correspronding command line the booting way. If you weren't going to run something like a Disk Operating System why would you want to boot anyway?
It may be obvious but I really did like it with computers that you didn't need to boot.
Sorry if I hurt anyone's feelings.
[0] so BASIC was dabbled in more often and widely as a "game" similar to the regular game cartridges, where they had to start from the beginning each time you turned on the computer, and all progress was lost when you powered down.
[1] http://www.atarimania.com/8bit/files/Kyan_Pascal_Manual.pdf
https://archive.org/details/cpc-464-intern-bruckmann-english...
(I have a physical copy of the followup book "CPC 664/6128 Intern", archive.org doesn't seem to have that one though)
(Amstrad community is the main reason I am thinking of learning German and Spanish :D)
RENUMBER takes maximum parameters of 32767 and 255.
But line numbers wrap! So if you do RENUMBER 32767,1 then your line numbers will go:
32767
0
1
2
...Btw does it allow 0? Amstrad's BASIC does not (oficially).
>0 REM
>10 REM
>RENUMBER 32767,1
>LIST
32767 REM
0 REM
>0 REM
>LIST
0 REM
32767 REM
0 REMHe also found some more info from the web and by trying stuff out:
Hey, I confirmed this is the same on the actual machine so yep it looks like this was part of the ROM. I found a small amount of info, including that the maximum actual line number is 65279 (BBC BASIC V file format — Matt Godbolt’s blog (xania.org). It looks like the BASIC editor only properly dealt with lines up to 32767 (0x7FFF), including ANDing them with that when using LIST!
Weird things happen if you have a program with line numbers beyond 32767. LIST shows the wrong line numbers, RENUMBER doesn't renumber GOTOs properly.