5

Ask HN: Why did BASIC use line numbers instead of a full screen editor?

 1 year ago
source link: https://news.ycombinator.com/item?id=34465956
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Ask HN: Why did BASIC use line numbers instead of a full screen editor?

Ask HN: Why did BASIC use line numbers instead of a full screen editor?
11 points by amichail 1 hour ago | hide | past | favorite | 14 comments
Home computers in the early 80s were certainly capable of providing responsive full screen editing, so why did they use line numbers for BASIC?
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).

Another reason: BASIC had a GOTO statement to change program flow to any point in the program. There was no idea of nested blocks of code that executed conditionally. The GOSUB directive was only useful in some situations.
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.
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.
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

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

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.
s.gif
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/

s.gif
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.
s.gif
I mean at the point when basic was being ported to home computers, thus the comment about backward compatibility.
s.gif
First lessons in extensibility were in BASIC, when the very young future software designer strategized line number increments.
s.gif
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.
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).

s.gif
Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search:

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK