3 ms·
Great points. One thing that might help out with correctness is typed forths. But I haven't played with any of them. And I'm not sure if that solves the readabi
by eatonphil 5y ago
Great points. One thing that might help out with correctness is typed forths. But I haven't played with any of them. And I'm not sure if that solves the readability issue when sometimes you have stack manipulations happen very far ahead or behind relevant code.
- kazinator 5y agoProbably, if you're doing complex calculations with Forth that have many operands, you should favor left-reductions: reducing the stack should be as eager as possible. Don't pile all the operands into the stack all at once followed by a soup of words to decimate them. The code generation algorithm should be: whenever you write down an operand to be pushed into the stack, then if a reduction is thereby made possible, you should add the word to achieve that reduction.
- DonHopkins 5y agoHP programmable reverse Polish notation calculators have a typed variant of FORTH called RPL, which is in some ways similar to Lisp or PostScript: https://en.wikipedia.org/wiki/RPL_(programming_language) https://en.wikipedia.org/wiki/RPL_(programming_language)