4 ms·
It depends on the implementation. With Indirect Threaded Code (ITC), "functions" are represented more or less as a list of other functions or primitives to call
by astrobe_ 6y ago
It depends on the implementation. With Indirect Threaded Code (ITC), "functions" are represented more or less as a list of other functions or primitives to call. But there are also classic bytecode-based Forth implementations, subroutine threaded code implementation (which is a simple form of native code generation), etc.
In my experience, Forth's "immediate" words, which let you execute code at compile time, combined with the availability of some (or most) of the compiler's part, let you do quite a lot of things.
In other words, you don't manipulate code, you directly generate code. For instance, if your implementation does not have 1+ (silly example), you can make a word "1+" that compiles "1 +" inline (or increment the top of stack if you interpret stuff from the REPL).
To answer your question, I use a dialect of Forth that has, I think, less capabilities than standard Forth in this area and rarely felt the need to implement them. At the risk of showing I am a blub programmer, I think homoiconicity is overrated - for the user (for language implementers maybe it's another story).