2 ms·
You can certainly override the ( word to replace its functionality. You can even do so late in the compilation process so that the new semantics only apply to t
by boomlinde 4y ago
You can certainly override the ( word to replace its functionality. You can even do so late in the compilation process so that the new semantics only apply to the code you write without affecting the rest of the dictionary.
I don't see why you would, though. Even in your trivial example "(IF (< A B) (THEN C ELSE D)))" the brackets are unbalanced and even if they were, IF would be executed after THEN and ELSE. When you push a word to the "X-stack" you correspondingly have to push a word to an analogue of a stack in your mind to know what happens when ')' executes. You failed to do this and therefore your example is broken. In idiomatic Forth, you wouldn't have to worry: in most cases you only have to consider the data stack, and in most cases the sequences you just read to your left imply what's on top of that, not what you read ten words back.
Even if it was slightly easier to read than idiomatic Forth (I disagree that it is), in-line comments strike me as more important "shit" than superficial syntax sugar.