News for hackers. Stuff that matters.
Re:Sectorforth: A 16-bit x86 Forth that fits in a boot sector by RodgerTheGreat on Sunday September 27, 2020 @06:29PM (#24610692)
Leaving out numeric literals is an interesting choice to simplify your Forth kernel. Not many languages have sufficiently flexible naming rules to permit something like ": 3 1 2 + ;"

Stylistically, one of the main suggestions I took to heart early in my career with Forth was to outright ignore "rot" and "-rot"; they make the stack tricky to follow. I see that helloworld.f defines "rot", but it's only used in one place.

Re:Sectorforth: A 16-bit x86 Forth that fits in a boot sector by samatman on Sunday September 27, 2020 @06:35PM (#24610740)
Related advice would be to annotate every stack effect with a comment, no exceptions.

Back when I was into Forth, I had this wild notion of adding a stack checker, defining two additional comment words which would be aware of the stack effect of all core words, and require a stack effect to be defined for every new piece of vocabulary.

Never did anything with it, don't write Forth anymore, doubt I will again. I still think it's a good idea though, so I like to put it out there.

Re:Sectorforth: A 16-bit x86 Forth that fits in a boot sector by dfischer on Sunday September 27, 2020 @07:42PM (#24611192)
Have you seen Factor? https://factorcode.org/
Re:Sectorforth: A 16-bit x86 Forth that fits in a boot sector by TapamN on Sunday September 27, 2020 @06:52PM (#24610841)
That's actually been done. It's called StrongForth.

http://www.arestlessmind.org/2009/02/03/intro.html

Re:Sectorforth: A 16-bit x86 Forth that fits in a boot sector by MaxBarraclough on Monday September 28, 2020 @04:32AM (#24614346)
You beat me to it. See also this other page on StrongForth: https://www.stephan-becher.de/strongforth/

See also the Kitten programming language, which does something similar: https://kittenlang.org/

Re:Sectorforth: A 16-bit x86 Forth that fits in a boot sector by cblum on Sunday September 27, 2020 @10:46PM (#24612468)
Yep, annotating the examples with stack effects is in my plans :)
Re:Sectorforth: A 16-bit x86 Forth that fits in a boot sector by cblum on Sunday September 27, 2020 @10:46PM (#24612472)
Oh, interesting. I feel like I've gotten used to reasoning with rot and -rot. Didn't know there was advice out there not to use it.
Re:Sectorforth: A 16-bit x86 Forth that fits in a boot sector by loa_in_ on Sunday September 27, 2020 @11:15PM (#24612624)
It's not any more or less intuitive to me than nip and over.

Where there's three or more items to be manipulated there's always at least ambiguity which way rot is supposed to rotate according to codebase author. With more than three items it's easy to see what can be done but no unambiguous and meaningful names. The only consistent stack word names that work 4 items deep are 2dup and 2drop.