4 ms·
I believe there are two big problems with Forth 1) losing track of the parameters in the stack (unlike Lisp, there are no parens to match and serve as containe
by mikewarot 4y ago
I believe there are two big problems with Forth
1) losing track of the parameters in the stack (unlike Lisp, there are no parens to match and serve as containers)
2) everything is a number/pointer. STOIC provides strings, hash tables and more, along with parameter type checking.
Those are, in my opinion, the two main factors that keep Forth from being the "dual" to Lisp.
- kragen 4y agothese are real annoyances but most people get stuck in the stack manipulation tarpit first before those become the main problems 2over should be safe, legal, and rare
- vanderZwan 4y agoWell, there is Kitten, although it hasn't seen an update in two years and was moving quite slowly before that too. https://kittenlang.org/ https://kittenlang.org/
- kragen 4y agoyeah, cat, kitten, and joy are interesting. sadly factor is abandonedish too because slava is too busy cloning kotlin
- flembat 4y agoForth is extensible, it is not complete out of the box like a C compiler. Just extend it with named local variables and use them. There is no shame and unless you are on some rare and exotic stack machine, no performance penalty using local variables. I also need to add safe strings with their own memory pool, rather than block copying bytes around in the same dictionary where my code lives. I am just not a good enough programmer to use Forth strings without crashing a lot.
- kragen 4y agofrom my non-expert viewpoint, the big penalty for named local variables in forth is that it is a barrier to breaking up a word into smaller words, because pieces of code inside the same word that communicate through a local variable will stop working if you break them into separate words bigger words impede using the forth repl as a line-by-line stepping debugger, so they diminish the interactivity that is the reason you'd use want to forth in the first place agreed about strings; one of the first things i wrote in forth was a straight port of bernstein's stralloc, last millennium
- Karrot_Kream 4y agoIf you can keep variables separate between different words, you can make sure that the variable stays local to the word. It is error-prone but can stop the variable from leaking and keep words separate.
- kragen 4y agowhat do you mean
- Karrot_Kream 4y agoDefine variables before you start defining words. Make sure you use one variable per word. It's a manual process but when composing words helps make sure variable collisions don't happen.
- Gordonjcp 4y ago> 1) losing track of the parameters in the stack (unlike Lisp, there are no parens to match and serve as containers) If you're losing parameters in the stack, you need to refactor. The whole idea of wrapping things in brackets is what makes Lisp such an unreadable mess. > 2) everything is a number/pointer. If you don't understand why everything is a number or pointer, you don't understand anything about programming languages.