4 ms·
Thinking back on BASIC, what stands out most to me are the line numbers. At the time, I never understood the point; I mean, sure, you needed them for GOTO and G
by peterevans 13y ago
Thinking back on BASIC, what stands out most to me are the line numbers. At the time, I never understood the point; I mean, sure, you needed them for GOTO and GOSUB. But it just seemed like so much labor. And, of course, why not labels, names for subroutines? Other languages had them.
But when you think back on how assembly looked and worked at the time, you realize that the line numbers are sort of analogous to addresses in memory. If you were on a 6502, you might JMP to a point in memory. You'd do the same in BASIC, except instead of a point in memory, it was an arbitrary number you used for the line.
So, weirdly, my thoughts on BASIC today is not that it was really BASIC. Not even that it was necessarily a great beginner language, though some people treated it that way. It was an easier shorthand for assembly.
- munificent 13y ago> Thinking back on BASIC, what stands out most to me are the line numbers. Because in most computers at the time, you didn't have an editor that could edit an entire source file. I remember writing BASIC on a TRS-80 and an Apple IIe. Those just had line editors. Line numbers let you identify which line in the program you want to edit. Typing in: 20 PRINT "HI" meant, "replace line 20 with that". You spaced out your numbers (usually multiples of ten) so that you had some available numbers if you need to insert some code between two lines. If that got crowded, typing in "RENUM" would renumber all of your lines and neatly space them out again. At a child, I remember thinking RENUM was the most magically complex algorithm I could imagine.
- dalke 13y agoI both agree and disagree with you. The sticky point is "at the time." BASIC came out in 1964, and other programming languages, like Fortran, COBOL, Lisp, and Algol, didn't need line numbers for each line. I suspect it had something to do with the display technology. Fortran and COBOL were designed with punch cards in mind. Lisp and Algol were designed for research computer scientists; I don't know what they used for I/O or hardware, but I suspect it was significantly more advanced than the line printers that Dartmouth students used. I think this helped make BASIC a good match as the first micro language a decade later where, as you say, most of those computers couldn't handle functionality beyond a line editor. I remember putting off RENUM as long as possible, because it forced me to re-learn where all of the useful GOTO/GOSUB targets were located.