[HN Gopher] Ask HN: Why did BASIC use line numbers instead of a ...
       ___________________________________________________________________
        
       Ask HN: Why did BASIC use line numbers instead of a full screen
       editor?
        
       Home computers in the early 80s were certainly capable of providing
       responsive full screen editing, so why did they use line numbers
       for BASIC?
        
       Author : amichail
       Score  : 15 points
       Date   : 2023-01-21 12:26 UTC (1 days ago)
        
       | knuckleheadsmif wrote:
       | Well back in the day... I did my Basic programming on a real
       | Teletype Terminal (not an TTY screen) connected via an acoustic
       | coupler running at 300 baud to a Honeywell timesharing system and
       | saved/loaded programs via punch paper tape on the mid 70s.
        
         | gonzo wrote:
         | 300 baud? Luxury on an acoustic coupler.
         | 
         | 150 baud (as a channel for a terminal running at 110 baud) was
         | far more typical.
        
       | syntheweave wrote:
       | It cost RAM to have a screen editor. A line editing routine is
       | compact, saves a lot of bytes over making something that can
       | scroll, copy-paste etc. The point of a built-in BASIC was that it
       | was complete as-is and could run programs instantly. Thus while
       | many languages for microcomputers used a batch compilation model
       | and could do away with bookkeeping, BASIC was always slimmed to
       | hit a nice small size and leave more room for user code.
        
       | skissane wrote:
       | The first version of Microsoft BASIC was written for the MITS
       | Altair 8800 - which didn't come with any graphics hardware, it
       | was normally used over a serial port, from a teletype. Given a
       | serial port talking to a teletype, full-screen editing is
       | impossible.
       | 
       | Microsoft went on to port their BASIC to more platforms, many of
       | which were capable of full-screen editing, yet they kept with the
       | line-oriented interface-why? It was a lowest common denominator
       | which worked across all hardware and was trivial to bring up on a
       | new hardware platform or operating system-full screen editing
       | would have required a lot more platform-specific code to be
       | written, and would have been more affected by differences in
       | capabilities between different platforms (screen sizes/etc).
        
         | scarface74 wrote:
         | Microsoft didn't "port" their software in the traditional
         | sense. It was a clean rewrite for each platform.
         | 
         | For instance, the Apple // graphics memory layout was really
         | weird.
        
         | miohtama wrote:
         | Full screen editing also requires much more RAM. Late 70s and
         | early 80s computers might have had 4 KB - 32 KB RAM. With such
         | limited system, it is hard to host a full screen editor or any
         | advanced compiler with jump labels.
        
       | Leftium wrote:
       | QuickBasic (1985) apparently did not need line numbers: "Although
       | still supported in QuickBASIC, line numbers became optional."
       | 
       | - https://www.wikiwand.com/en/QuickBASIC
       | 
       | And BASIC itself was developed in 1963, when full screen editors
       | may not have been as feasible.
       | 
       | - https://www.wikiwand.com/en/BASIC
        
       | joezydeco wrote:
       | Another reason: BASIC had a GOTO statement to change program flow
       | to any point in the code. There was no idea of nested blocks of
       | code that executed conditionally. The GOSUB directive was only
       | useful in some situations.
       | 
       | GOTO needed somewhere to jump to and the easiest thing to
       | delineate was a line number.
        
       | neilv wrote:
       | Here's a video approximating coding on a early-'80s home
       | computer, complete with some simulated(?) NTSC TV ambiance
       | effects:
       | 
       | https://www.youtube.com/watch?v=mOqguR3bBsk&t=1m8s
       | 
       | (Some things I didn't notice them getting into were `RESEQUENCE`,
       | retyping a line with its number to edit a line, storing the
       | program to flaky audiocassette, and losing the only copy of the
       | game you were developing because you left your tape in, and your
       | little brother absent-mindedly pressed the Record button while
       | waiting his turn to play Parsec.)
        
       | fortran77 wrote:
       | I first programmed in BASIC on an ASR-33 terminal. Try using a
       | full screen editor on that device!
        
       | wruza wrote:
       | BASIC had to work on tiny chips and not fill the entire ROM and
       | RAM by itself. Probably that's the reason. Later basics (Quick,
       | Turbo) worked as "IDEs".
       | 
       | As a side note, neither early DOS nor CP/M had a full screen
       | editor either, _afair iirc_. Edlin (poor man's ed) is my earliest
       | memory, which was a line-oriented editor.
       | https://en.wikipedia.org/wiki/Edlin
        
         | scarface74 wrote:
         | I didn't realize that the "Edit" program didn't come with DOS
         | until 1991
        
       | ChrisMarshallNY wrote:
       | _> Home computers in the early 80s were certainly capable of
       | providing responsive full screen editing_
       | 
       | Not exactly. Home computers leveraged televisions; often by
       | generating radio signals (as opposed to direct video input).
       | 
       | The quality was _awful_. You couldn 't rely on the screen to do
       | much better than 320 X 240.
       | 
       | Also, in those days, most of us used 300-baud terminals, which
       | were VGA (640 X 480). Not much room for chrome.
       | 
       | The displays were ASCII-driven. Basically the precursor to
       | Emacs/Vi.
       | 
       | Also, as was pointed out in another comment, structured
       | programming was still in the future. If you were lucky, you had
       | GOTO.
       | 
       | Line numbers didn't use up characters. They could be inferred.
       | Memory was _not cheap_. It was also _very_ limited. Every
       | character (including comments), used up memory, and impacted
       | performance.
       | 
       |  _< GrumpyOldManVoice>_
       | 
       | You kids don't know how good ya got it. Back in my day, we had to
       | use a morse code keypad for data entry...
       | 
       | Get off my lawn...
       | 
       |  _< /GrumpyOldManVoice>_
        
       | scarface74 wrote:
       | On Apple II computers you did have a screen editor of sorts. You
       | listed the line you wanted to edited, you pressed ESC and you
       | could move your cursor up to the line you wanted to change and
       | overwrite it.
        
       | ChicagoDave wrote:
       | I'm on the floor (laughing).
       | 
       | Most computer labs had punch card stations and paper terminals
       | when BASIC was created.
       | 
       | You often used LIST to see your program and edited it by adding,
       | removing, replacing line numbers.
       | 
       | Later on DEC terminals we had an editor named TECO that allowed
       | you to do search and replace, inserts, and other line-oriented
       | changes. I'd have my school programs memorized so I could type
       | commands without a list.
       | 
       | Video terminals (and PCs) became common in the mid 80's. Screen
       | editors were still slow on video terminals (connected to shared
       | runtime systems), but awesome on PCs.
        
       | h2odragon wrote:
       | It wasn't invented for home computers, it was invented for line
       | printer terminals, where "line numbers" and the ability to
       | edit/insert that gave was a real improvement.
        
         | eternalban wrote:
         | First lessons in extensibility were in BASIC, when the very
         | young future software designer strategized line number
         | increments.
        
           | knuckleheadsmif wrote:
           | Anyone whoever programmed on punch cards always numbered them
           | so the you could sort them if you ever dropped your deck.
           | Strategic numbering was even more important then. Most of us
           | preprogrammed the punch machines, via a punch card itself
           | mounted to a drum, to help with the numbering.
        
             | greenbit wrote:
             | Don't forget to draw a diagonal line across the side of
             | your card deck. Don't skimp and use a pencil, get a nice
             | felt tip marker.
        
         | benj111 wrote:
         | I don't think that quite explains it though. It wasn't as if
         | the idea of a screen editor hadn't occurred to them.
         | 
         | So if that was the reason it was because of compatibility.
         | 
         | There's probably also the issue of keeping the code text in
         | memory, an issue when talking about the zx80 end of the
         | /spectrum/
        
           | Jtsummers wrote:
           | BASIC was from 1964, screen editors weren't a common thing at
           | that point in history. Many of the implementations that made
           | it into early home computers weren't too distantly altered
           | from that original version.
        
             | benj111 wrote:
             | I mean at the point when basic was being ported to home
             | computers, thus the comment about backward compatibility.
        
       | zabzonk wrote:
       | basic was not developed in the early 80s - early 60s
        
       | greenbit wrote:
       | It was a combination of things. It allowed a simple line entry
       | system to organize a collection of lines as a linked list,
       | yielding a really simple program editor AND at the same time
       | provided convenient (for the interpreter) labels to use as
       | targets for the likes of GOTO and GOSUB
        
       | readthenotes1 wrote:
       | The last time I programmed BASIC was in the 1970s, and it was
       | already over a decade old.
       | 
       | All the answers from the '80s make me laugh.
       | 
       | (Well, at least the laughing is true. )
        
       | msh wrote:
       | I think this stackoverflow answer gives a good answer:
       | 
       | https://softwareengineering.stackexchange.com/questions/3097...
        
       | ratboy666 wrote:
       | Memory constraints. BASIC will run in 4 to 8 Kbyte (4000 to 8000)
       | ROM. That budget was for editor, SAVE/LOAD,interpreter and
       | overhead functions. The goal is to make the interpreter fast!
       | 
       | And, these were pre-IBM PC systems. (apple, radio shack 8 bit
       | systems, many others).
        
       ___________________________________________________________________
       (page generated 2023-01-22 23:00 UTC)