5 ms·
Had this discussion on Discord as well. Like most things Forth it depends how you use it. If we consider the classic indirect threaded systems, then every fiel
by lebuffon 3y ago
Had this discussion on Discord as well. Like most things Forth it depends how you use it. If we consider the classic indirect threaded systems, then every field in a definition is an address called an execution token (XT). In most systems you can convert an XT back into a text label. This allows pretty simple de-compiling for example.
It is trivial to collect those Xts as data and execute them later.
CREATE XT-LIST ] THESE WORDS COULD BE FORTH CODE [
XT-LIST now contains six XTs. They can now be read one XT at a time and executed.
So if one accepts that those XTs are data, BUT they are also code since they can be "executed" by the Forth VM then I think we can say Forth is homoiconic.
However if that doesn't suffice it is perfectly legal to pass text strings to EVALUATE.
: TEST S" THESE WORDS COULD BE FORTH CODE" EVALUATE ;
That's all I got.
- runlaszlorun 3y agoAha, that’s pretty awesome. I’m familiar with XT’s but hadn’t thought of using them that way. And didn’t know that you can convert back to text. I’m going to have to do more Forth. And I have a sudden urge to go write some silly self-modifying assembly, if current processors even allow that anymore.