9 ms·
You're right of course, this is an ongoing exploration. I hope to learn the deeper truths in the process.
by reinvdwoerd 9y ago
You're right of course, this is an ongoing exploration. I hope to learn the deeper truths in the process.
- nickpsecurity 9y agoFeel free to have fun with Haskell and Forth all you like. Your project. :) However, you need to learn C and/or ASM then implement Forth and some system codeto get to the deeper truths. Probably. Quite a bit of people using it in embedded systems.
- jacquesm 9y agoI would suggest re-doing the exercise on an 8 bit cpu with < 8 K of RAM. That will open your eyes to what is so special about Forth.
- robert_tweed 9y agoI'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 ago
- 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.
- brians 9y agoOne good place to look for that is <http://git.annexia.org/?p=jonesforth.git;a=summary> http://git.annexia.org/?p=jonesforth.git;a=summary>, previously discussed at <https://news.ycombinator.com/item?id=942684> https://news.ycombinator.com/item?id=942684>.
- jlg23 9y agoThanks for the links, had not seen this before. (though your links are slightly broken)
- rwmj 9y ago[Disclosure: I'm the author of JONESFORTH] If you search on github there are several clones and indeed forks on JONESFORTH. It is public domain, so I welcome that: https://github.com/search?utf8=%E2%9C%93&q=jonesforth&type= https://github.com/search?utf8=%E2%9C%93&q=jonesforth&type= There are also versions ported to several other architectures, which I occasionally announce on my blog (when people email me about it :-) https://rwmj.wordpress.com/?s=jonesforth https://rwmj.wordpress.com/?s=jonesforth
- throwaway7645 9y agoThank you as JonesForth keeps getting hard to find. Any chance you will ever do an even more in-depth tutorial? Put it on lulu and I will buy. I'd like to write my own Forth, but need a bit more handholding.
- rwmj 9y agoIf the tutorial is hard to find, please feel free to clone it on the git sites of your choice. In depth: Likely not. I've actually been working on another literate language tutorial (completely unrelated to FORTH), so ... watch this space (or my blog).
- throwaway7645 9y ago
- spc476 9y agoIf you can get DOES> working, you really understand how Forth works. I have a toy Forth implementation where I got DOES> working, and I still have a hard time understanding how I got it working.