1x Forth (1999)
ultratechnology.com
ultratechnology.com
The indirect threading model was absolutely brilliant. Almost every bytecode VM in existence today owes Forth (and Moore) a giant "thank you." If you never write a lick of Forth code ever, you'll be a better programmer just by researching how its put together.
Forth also pushed for simplicity before it was fashionable. Most "modern" languages pride themselves on their landing-page code samples:
sum = fold (+) 0
But, again, this is old hat for Forth programmers. Languages today use a lot of great, new ideas to accomplish this: FP, pattern matching, closures, etc. But Forth was pushing - back in 1970 - for all functions to "do one thing" succinctly. If it can't be done in one line, you needed to factor the code some more. And, it's not just that the result is one line, it's that _anyone_ can look at it and know what it does instantly. Remember, this was back when BASIC and FORTRAN ruled with GOTO.
Finally, I feel that Forth programmers learn - early on - something I don't see many (very good) programmers learning today: instead of constantly abstracting and obfuscating to try and "simplify" a solution, take a step back and try and simplify the _problem_ so the solution is obvious. For example, this is what I feel the Rust team has done with memory management. Instead of just throwing more brain cells and cycles at trying to improve old-hat solutions, turn the problem upside-down and - in essence - remove it entirely.
Funny, I see bytecode VM as one of the things that's fundamentally wrong with computing. It's one more layer of unnecessary crap that doesn't even remotely resemble the underlying hardware.
And that is what makes the code portable and re-usable. See also Rob Pike's Eulogy on Dennis Ritchie[0], where he explains the true strengths of C and Unix:
> In the late 1970s, Dennis joined with Steve Johnson to port Unix to the Interdata. From this remove it's hard to see how radical the idea of a portable operating system was; back then OSes were mostly written in assembly language and were tightly coupled, both technically and by marketing, to specific computer brands. Unix, in the unusual (although not unique) position of being written in a "high-level language", could be made to run on a machine other than the PDP-11. Dennis and Steve seized the opportunity, and by the early 1980s, Unix had been ported by the not-yet-so-called open source community to essentially every mini-computer out there. That meant that if I wrote my program in C, it could run on almost every mini-computer out there. All of a sudden, the coupling between hardware and operating system was broken. Unix was the great equalizer, the driving force of the Nerd Spring that liberated programming from the grip of hardware manufacturers.
> The hardware didn't matter any more, since it all ran Unix. And since it didn't matter, hardware fought with other hardware for dominance; the software was a given.
[0] https://plus.google.com/u/0/+RobPikeTheHuman/posts/33mmANQZD...
And hardware still very much matters, even if it's running Unix, because of binary compatibility.
I still don't get the VM thing. I mean, I get it from a portability standpoint, but in practice it's been a pretty horrible thing because a stack machine of all things is often picked as the virtual target. Why not a generic register based machine, like most hardware actually is these days? My feeling is the people doing the implementing are infected with the Forth virus, and a stack based VM is one of the few ways they can force their crazy ideas on the rest of us.
And while I'm no compiler writer, I suspect stack machines are a great choice for modelling an intermediate language because converting it to optimal register use is fairly simple, yet at the same time is completely agnostic about how many registers an underlying machine has.
No, I don't understand that, and honestly have no clue what you're talking about. C is about as simple as things come, and it doesn't necessarily make strange demands on the hardware. It may seem that I'm contradicting my previous statement, but C working well with hardware doesn't necessarily mean it is a force for shaping modern hardware.
Three operand register-based load / store machines make too much sense from a variety of angles for many (any?) other configurations to touch them, that's why they're everywhere.
Stack machines are inherently less efficient, and you only see a bunch of designs (mostly as amateur soft cores) to this day because they are almost trivial to for enthusiasts to implement, not because they kick ass.
Clearly.
https://en.wikipedia.org/wiki/Lisp_machine#End_of_the_Lisp_m...
When I read Moore's material, I feel like he fell into that positive feedback loop in some kind of pathological way... He keeps rebuilding and rebuilding basically the same CAD hardware/sw system, recreating it simpler and more elegant in his eyes every time. For years and years.
Building a forth system from scratch really is an eye-opener... Many have written about how strange and beautiful it is to take your base language and then add the ability to make comments and perform if-then control flow from inside the language. You build it up from nothing but it's a functioning language/interpreter the whole time. Very cool.
Here's my favorite - demonstrating his CPU CAD software back in the early 90s, written in Forth and running on a PC. Quite impressive for back then.
Part 1: https://www.youtube.com/watch?v=B_cf8n58Ews
Part 2 (the meat of the presentation): https://www.youtube.com/watch?v=Dbd7Xu0ibJM
"Chuck Moore, the inventor of Forth and ColorForth programming languages, gives a presentation on writing "1x software," or how to avoid common sources of bloat in software. Topics covered include: what it means to be Forth (as distinct from other languages), how ColorForth is simpler still than Forth, how common system services such as files, windows, and even local variables, complexify (complect) the software, the impact of bloat, maintenance on that bloat, etc. And, as is usual for Chuck, deeply philosophical thoughts as well."
But when the project changes in certain ways, that bespoke foundation no longer suffices. Time to take the wrecking ball to it and start building a new cathedral.
It is technically true that you can reduce the sheer amount of code involved with a running program, but I for one would not wish to. I would rather inherit the problem-solving, optimization insights, and compatibility tackling of others inherent in OS modules and libraries (along with their "bloat" and complexity), than carry all the weight of non-project-specific development from bare metal. This is a statement of scope and time as well of that of surface of opportunity for bugs and weaknesses.
Another article, more interesting in my view than this one, about the apparent mindset: http://yosefk.com/blog/my-history-with-forth-stack-machines....
That's all well and good, but some people are building web browsers, or distributed AI databases, or even large chip development suites that do things that certainly wouldn't fit in 500 lines of Forth. Forth is a great expression evaluator, and has actual compile-time metaprogramming features, which is nice. But it doesn't solve actual large problems for you. It asks you if you can solve a non-large problem, and if you can, you're happy with Forth.
It's sort of like retro programming. You can work in a small (architecturally conceptual) scope that handles a few things elegantly, and implement some cool project within those constraints and building blocks. But it's still building a little cathedral per project.
>> If it were a lot simpler I would have a lot more confidence that the technology would endure into the indefinite future.
I think he is (correctly) speaking to the byzantine systems which have been propped up (successfully!) to engineer the kinds of applications we are accustomed to (terminal emulators spanning hundreds of thousands of lines of code, web browsers spanning tens of millions etc.). It seems (from what I've read from and about Moore) his idea of empowering people is simplifying the surface area of a problem, rather than simplifying an interface to the problem (for lack of a better phrase).
People can't really use the solutions he presents or advocates to solve the kinds of problems they face with computers as they are being used but the argument might be made that they're solving the wrong problem. I think that we'll eventually come around to some diluted, almost unrecognizable conclusion along these lines - see the number of people advocating a "burn it all down and start over" approach after just half a century of computing. See also the amount of work spent on maintaining compatibility with relatively ancient systems in spite of these arguments.
I dream of a future where my bank (for example) publishes API documentation which can be used to successfully implement a working first-class client. That client can then be an actually-good piece of software.
The web is an awful platform for applications, and the only reason for its success in this space was ubiquitous and consistent deployment.
What are some examples of highly complex tasks that have had Forth programs written for?
Something like Starcraft in Forth. Or perhaps the most complicated Paint Program written in Forth.
https://en.wikipedia.org/wiki/RTX2010
ChipWits was a programming game written in MacFORTH.
In embedded environments like control systems or CNC, it is also quite common to find some kind of Forth. These are not exactly painting programs, but they are used to paint with laser or water jet on real world materials, which is cooler.
And, although it is not Forth, postscript follows similar principles. You could consider ps as a quite advanced paint program.
http://www.ultratechnology.com/scope.htm
Bit of a toy demo though since it only ran a single fake program.
A chess game: http://www.ultratechnology.com/chess.html
The largest serious suite I know of is a VLSI CAD/simulator for silicon chip design:
http://www.ultratechnology.com/okad.htm
http://www.ultratechnology.com/okad2.htm
Pictures of it in action: http://www.ultratechnology.com/tape1-2.htm
Many programs, 2d, 3d, editors, voxels, compilers, etc ..
Everything is written in that colorforth inspired language.
I wanted to love Forth, but it's a cumbersome tiny language tied to a couple of stacks that you have to micro manage. DUP, DROP, SWAP, etc. are inefficient, much like copying a value from one register to another, which is why most modern processors are 3 operand (to include the copy/move in the operation). And running a stack-based language like Forth on a register-based processor is a poor fit and inefficient, but that isn't necessarily a reason to build custom hardware that fits the language (we don't really do that anymore). This Emperor has no clothes.
Cue the true believers.
No wonder it's a massive struggle to do anything more than trivial projects in Forth, writing assembly is always a huge pain in the ass.
We need to get past Forth's exoticism and see it for what it really is: assembly + a huge dose of obfuscating downtrodden underdog philosophy.