5 ms·
That is an unfair comparison. Forth is designed to run on metal, with no os, no stdlibc, no vector. Can any of other language do that? In fact, by just adding
by co_dh 7y ago
That is an unfair comparison. Forth is designed to run on metal, with no os, no stdlibc, no vector. Can any of other language do that?
In fact, by just adding first class function, retro forth makes the code way easier to read.
- davidgay 7y ago> That is an unfair comparison. Forth is designed to run on metal, with no os, no stdlibc, no vector. Can any of other language do that? Not much of a stretch with C, really - there's a reason its used to write operating systems ;) (the standard library is mostly about OS interaction which is irrelevant in the bare metal/no OS context) On some systems, C requires a minimal library for compiler-emitted intrinsics (e.g., for 16/32-bit multiplies on 8-bit systems, for floating point, etc).
- madhadron 7y agoI think you misunderstand. When the parent says "designed to run on metal" they don't mean "designed to be cross compiled to produce binaries that run on metal", they mean "the compiler, editor, etc. are all running on metal."
- mikekchar 7y agoOne of the very first things I thought of when I heard about WASM is, "Oh.. It would be so fun to build FORTH on that". I never got around to it (yet) and from a quick search, there are already a ton of implementations. But I think this is one of the things about FORTH: it's not just that you can run it on the metal. It's that you can easily build a FORTH environment for pretty much any metal you can think of. Bootstrapping from absolutely nothing to a very productive environment is really an empowering feeling. I always thought it was a shame that there are so many people who have made a Lisp, but so few that have made a FORTH. I kind of feel like both of these tasks should be required material in school... Though I only have nebulous feelings about why it is valuable... Not sure I could explain it to someone who hasn't done it already.
- colomon 7y agoI haven't done any serious Forth programming in 30+ years, but every time I see a limited resources programming environment, I immediately get the urge to implement Forth on it. "This new game is going to include a DCPU-16 virtual computer you have to program? Great, all I need to do is implement Forth on it..." Luckily for my already very limited spare time, so far I've managed to resist this urge.
- kragen 7y agoThat pretty much describes everything in the first 20 years of computers (1945 to 1965) as well as everything in the first 10 years of personal computers (1975 to 1985), plus a fair bit of stuff that came after that. Even once operating systems were invented, they took a long time to get adopted. Just about every PC before the IBM PC came with a BASIC interpreter with a built-in editor and some kind of storage interface, running on the bare metal. So did every IBM PC up to at least the PS/2. CP/M did provide a BIOS and BDOS, but they really were very basic, providing little more than a convention for talking to the terminal and avoiding overwriting disk sectors some other program was using. MS-DOS didn't do much more, especially in the early years. So, I'd say that every programming language implementation from that time qualifies, including Microsoft BASIC-80 (originally Altair BASIC), VisiCalc, Turbo Pascal up to version 3.0, Apple Integer BASIC and AppleSoft BASIC, the 6809 BASIC Microsoft developed for the TRS-80 Color Computer, ZX-81 Sinclair BASIC, BDS C with the RED editor, and so on; not to mention the first FORTRAN compiler (and up through at least FORTRAN III), LISP 1.0, COBOL, and assemblers for pretty much every machine. Also, and perhaps most notably of all, Smalltalk on the Alto, Mesa and Cedar on the Alto, and Oberon on Lilith and its successors (including a version for the IBM PC). So, Forth is far from unique in being a bare-metal IDE without requiring an OS. It's just unusual in still surviving in that form.
- OneWingedShark 7y ago> Not much of a stretch with C, really - there's a reason its used to write operating systems C is a terrible language for Operating Systems. No modules, weak-typing, and full of gotchas and pitfalls — plus, it's answers like this that ignore the history of OSes: the Burroughs was written in Algol, Multics was written in PL/I, and VMS in BLISS (plus other languages, thanks to the design/architecture of the CLE).
- OneWingedShark 7y ago> Can any of other language do that? Ada can. The biggest Ada vendor actively pushes Ada-as-an-embedded-language, which is nice in some ways, but in others it can make it seem like Ada is only for embedded.
- co_dh 7y agohttp://forth.works/examples/AddingVectors.retro.html http://forth.works/examples/AddingVectors.retro.html Here is the retro forth version of adding vector that I was talking about. Tri@ apply function (2+x)on top 3 items. So get address of the 3rd element of c b a ..