Forth versus C
inventio.co.uk
inventio.co.uk
That's fairly subjective. I find the whole "keep track of the stack in your head" thing quite irritating, to be honest. Forth is more dynamic than C, certainly, but beyond that, I find C much easier to utilize in that you mostly concentrate on what you're doing rather than dup dup swap drop roll bee bop a lop bam boom tutti frutti etc... C's big "extraneous" overhead is keeping track of memory allocation.
"Though it's possible to write a garbage collector."
There is a Garbage Collection package available for Forth here (http://www.complang.tuwien.ac.at/projects/forth.html). > Q. So why doesn’t everyone use Forth?
> A. Because it is also possible to write worse programs
> in Forth than in C.Forth and C are low-level languages. I can (and do) use them to develop firmware.
Lisp and Java are for "big-iron" system.
But you are right, one of the strength of Forth and Lisp is the availability of a REPL.
Even Java is used in the embedded world today (luckily not my world).
Simply, C and Forth can scale down to really small MCU with few hundreds bytes of code space and some bytes of RAM (with Forth, on such small target you will probably loose REPL).
A readily available OSS Forth I really like can be used on small MSP430 where no lisp or scheme can go! (www.camelforth.com)
Currently most embbeddable scheme I know is the Armpit http://armpit.sourceforge.net/
BTW this specs put some lights on some java behavior: http://www.devx.com/Java/Article/10686.
"Some Forth practitioners advocate storing source code in variable-length, named text files, deliberately emulating the approach used in traditional compilers and text editors. This approach may become more and more common, but its usefulness is still controversial.
Sure it's nice not to have to worry about running out of room in a screen, but the hassle of writing in a restricted area is compensated for by retaining control of discrete chunks of code. In developing an application, you spend a lot more time loading and reloading screens than rearranging their contents.
"Infinite length" files allow sloppy, disorganized thinking and bad factoring. Definitions become longer without the discipline imposed by the 1K block boundaries. The tendency becomes to write a 20K file, or worse: a 20K definition."
(from page 144 of the 2004 edition)
This doesn't mean you can't create Forth programs from standard text files. All modern Forths work this way, providing blocks only as an additional feature.
If nobody thinks like this any more though, congrats on escaping what is normally a sure route to smug weenie-ism.
*Eg. later in the same section, Brodie suggests defining constants associated with block numbers as a sort of ersatz filenames
Nice.
So this kind of information is a bit dated.
If you look at current forth implementations (gforth, Forth inc and MPE comes to mind) none of them is screen based; you can decide if is good or bad ;-)
1K block limit seems like it could be a useful device for making functions understandable at a glance.
As I remember, Steve McConnell said studies have shown the most bugs can be found in very long and very short functions...
Did you mean something else?
Also, I assert that any "A versus B" will almost invariably favor A.