3 ms·
The Factor community likes to use the following phrase to answer that question and I think its quite correct: "Idiomatic Factor does not use the stack". That i
by dkersten 17y ago
The Factor community likes to use the following phrase to answer that question and I think its quite correct: "Idiomatic Factor does not use the stack".
That is, well written idiomatic Factor makes use of higher level abstractions which hide the stack from you. The stack should not be used as a data structure, but rather as a scratchpad to allow pointfree programming. Factor provides a load of abstractions which can often handle all of that low level stack handling stuff for you, making the code easier to read, follow and understand (once you know the abstractions). Factor also provides local variables, for use when it makes sense to name your data. Its not shunned to use them over the stack - when it makes sense to. Finally, Factors macros allow you to modify how the code is parsed (Factor calls them "parsing words"), so you can actually change the syntax. Core Factor provides an "infix" parsing word which allows you to write infix expressions and it is advised to do so when it makes sense (eg, for mathematical formulas). Another example of parsing words put to great use is Jeremy Hughes' inline C/C++ library, which basically allows you to write C/C++ code inline in Factor source files. During compilation, Factor will compile this code with GCC and simplifies writing of FFI stubs for wrapping C/C++ libraries.
Basically, Factor is very different from Forth. Slava likes to say that "Factor has more in common with Lisp than it does with Forth" and its often said that Factor only has a syntactical resemblance to Forth, but is otherwise very different.