4 ms·
I think this stackoverflow answer gives a good answer: https://softwareengineering.stackexchange.com/questions/309767/why-did-basic-use-line-numbers https://so
by msh 4y ago
I think this stackoverflow answer gives a good answer:
https://softwareengineering.stackexchange.com/questions/309767/why-did-basic-use-line-numbers https://softwareengineering.stackexchange.com/questions/3097...
- hedgehog 4y agoTake this detailed answer and view it with the perspective of having to fit BASIC along with everything else in ROM into 12KB (in the case of the Apple II).
- Starwatcher2001 4y agoThe TRS-80 level 1 ROM was 4k and the BASIC had the luxury of exactly 3 error messages: What? How? and Sorry.
- zokier 4y ago> The structure of memory was that of a linked list with a 'next line' pointer in the structure. This made it easy to add new lines between two lines - but you had to number each line for it to work properly This doesn't make much sense to me.. why does storing the lines in a linked list require line numbers?
- Someone 4y agoThe editor (if you could call it that) was stateless. There was no ”current position”. Its only commands were - list lines X to Y - “change line X to ‘foo bar baz’” - discard the entire program They could have chosen to use indexes for line numbers, but allowing programmers to label each line with a ‘virtual’ line number made it somewhat easier for programmers to keep track of where code lived (imagine having to keep track of the fact that, after inserting three lines to the subroutine starting at line #100, the subroutine formerly starting at line #200 now starts at line #203) It also meant that the interpreter didn’t have to make such adjustments to subroutine calls in the program (changing “gosub 200” to “gosub 203”)