5 ms·
I'm curious about Forth, as it's probably the most important language I've never learned. I've done a fair bit of low-level, micro-optimised coding in C and ass
by robert_tweed 9y ago
I'm curious about Forth, as it's probably the most important language I've never learned. I've done a fair bit of low-level, micro-optimised coding in C and assembly, but don't get much time for that kind of thing these days.
How would you describe Forth in relation to those? What makes it stand out and what are its weaknesses?
- jacquesm 9y agoForth is probably the smallest true high level language there is. It is entirely self-contained, needs just about nothing in terms of hardware support and can run in as little as 2K of memory. It is well suited to things like real-time control, you'll probably have a hard time getting used to stack manipulation (especially in the beginning) and it tends to keep you up all night (not sure if that is a strength or a weakness ;) ). It will also be the most fun you've had with a computer in a long time and it will likely make you look at the rest of what we do with computers as clunky in the extreme. What Forth is not really suitable for is large projects and things built with a team. It is more of an artisanal thing, something closer to watchmaking or jewelery than major construction. If you want to know more about why Forth is the way it is you could do worse than to start with studying the life of Chuck Moore for a bit, the language and its author are roughly equally interesting and for want of a better word peculiar. One thing Forth is not: wasteful.
- throwaway7645 9y agoRead Chuck talk about OKad...when the hardware wasn't to his liking he built his own chips...after writing his own CAD software in only like 5k loc that runs waay faster than traditional CAD software and uses almost no resources.
- nickpsecurity 9y ago"It will also be the most fun you've had with a computer in a long time and it will likely make you look at the rest of what we do with computers as clunky in the extreme." Double true if one looks at the hardware and software Chuck Moore makes with it.
- rezaprima 9y agoCan you tell me the link?
- nickpsecurity 9y agohttp://www.ultratechnology.com/cowboys.html http://www.ultratechnology.com/cowboys.html
- PeCaN 9y agohttp://www.greenarraychips.com/ http://www.greenarraychips.com/ is his current company, mostly notable for extremely low-power chips using asynchronous circuits (i.e. there's no central clock). IIRC he develops the CAD software he uses to design chips on his own chips.
- gerdesj 9y agoI remember writing a fairly trivial program in Forth on a ZX81 for a school open day. You needed the 16K RAM pack thing with the usual lump of Blu Tac to stop it wobbling. When I "discovered" Forth, it seemed like science fiction (soo fast!) to me after BASIC juddering around the screen.
- pedrow 9y agoProbably worth mentioning the Jupiter Ace here[0] - a ZX81/Spectrum era computer which had Forth in ROM, instead of BASIC which was common at the time. The basic model only had 1K of RAM. I never used one but I remember when it came out, reviewers commented on its speed and memory efficiency. [0]: https://en.wikipedia.org/wiki/Jupiter_Ace https://en.wikipedia.org/wiki/Jupiter_Ace
- yumaikas 9y agoDo you think that a concatenative language could be suitable for a team to use?
- Karrot_Kream 9y agoIn addition to other comments: Forth is a really cool language, but has the pitfall of trading time for space. It's a very lean language, and incredibly dynamic, but its heavy reliance on jumps makes it run slowly on modern hardware and thrashes most branch predictors.
- coliveira 9y agoModern CPUs are optimized for C code. This is not the fault of FORTH, but it certainly is a problem for its adoption.
- Karrot_Kream 9y agoNot really, modern Lisps have done a fine job optimizing performance. FORTH suffers from treating the hardware too granularly, and thus not being able to take advantage of any of the advances in hardware in the last 2 decades.
- yorwba 9y agoThere is no a priori reason FORTH can't take advantage of modern hardware, since in the extreme case the compiler can be completely replaced by redefining the meaning of ':' and ';'.
- throwaway7645 9y agoThis is why Chuck Moore designed his own chips like GreenArrays I believe. There is no impedance mismatch between software and hardware and the entire thing is optimized for the problem domain and massively parallel. I'm sure you can get more speed out of C, but it no other language (even Lisp or Smalltalk) can the user understand the entirety of the system. Lisp machines and Smalltalk machines probably are about as close as possible, but I have zero experience with them personally. Perhaps the project to put PicoLisp on bare-metal qualifies if one uses a simple enough microcontroller as the language itself is about as simple as you can get a practical lisp.
- spelc 9y ago
- flavio81 9y agoLast time i did some coding in forth, it was Fig-Forth on the 8-bit Atari 800XL. It was really fun and I was amazing on how fast it could run despite being in such limited hardware. I would say Forth is easier to use than assembly, and perhaps much more flexible/extensible than C, although in some senses lower level since C gives you a very nice, ordered way of specifying what are the arguments to your functions/etc.