3 ms·
> Line numbered BASIC is homoiconic: you can edit any line of code and continue the program. Oh man, anyone else remember those self-modifying BASIC programs,
by gwd 2y ago
> Line numbered BASIC is homoiconic: you can edit any line of code and continue the program.
Oh man, anyone else remember those self-modifying BASIC programs, which would:
1. Clear the screen
2. Print a bunch of new BASIC lines on the screen, with a CONTINUE command at the end, thus:
100 PRINT $NEWVAR
110 <whatever>
CONTINUE
3. Position the cursor at the top of the screen
4. Enable some weird mode where "Enter" was considered to be pressed over and over again
5. Execute the BREAK command, so that the interpreter would then read the lines just printed?
I forget the kinds of programs that used this technique, but thinking back now as a professional developer, it seems pretty wild...
- gwd 2y agoDecided to look it up. Ah, memories: https://www.atariarchives.org/creativeatari/SelfModifying_Programs.php https://www.atariarchives.org/creativeatari/SelfModifying_Pr...
- eep_social 2y agoYour description makes me think of quines? https://en.m.wikipedia.org/wiki/Quine_(computing) https://en.m.wikipedia.org/wiki/Quine_(computing)
- tolciho 2y agoYou can (sort of) do this with a shell script combined with another process that seeks the (shared) file descriptor somewhere else in the file, as the shell is very line oriented. Not very well; it requires that the shell script block or sleep while the other process fiddles with the seek position.
- gwd 2y agoIn bash you have "eval", which I've used for some monstrosities in the past; but at least doesn't need to be visible to the user as you're doing it!