Hacker News new | ask | show | jobs
by epmos 1514 days ago
> But it seems odd that they wouldn't at least save a LUT relating the shortened and expanded variable name.

BASIC implementations based on Microsoft BASIC store tokenized program lines. A keyword takes 1 byte. Comments, variable names, spaces between tokens, etc take up memory on a character-by-character basis.

I didn't use Apple BASIC, but I spent too much time on various flavors of Commodore BASIC which shared this heritage. Changing a variable from "ACCUMULATOR" to "AC" to "A" saved memory and made the program run faster. The problem of not being able to make sense of your own program after was very real.

2 comments

There was a weird thing in IBM BASICA (which apparently became GW-BASIC) where runtime writes to a pointer to a program variable could corrupt your program listing itself. I think this had to do with variable contents actually being stored inside the source code somehow? Do you know any more about this, or does anyone else remember this?
Sure, I meant saving that LUT somewhere else for future reference