7 ms·
colorForth (2009)
- fractallyte 5y agoThe Wiz Biz, by Rick Cook Silicon Valley programming wiz finds himself transported to a magical world. Spellcraft is archaic and stagnant. What's a curious hacker to do? Bootstrap a new magical 'programming' environment - using Forth, obviously! Great fun! https://www.baen.com/the-wiz-biz.html https://www.baen.com/the-wiz-biz.html
- stevekemp 5y agoI'll always vote up submissions referencing anything FORTH related. For me FORTH is as much fun as lisp appears to be for others. I've never really done much with it, but I always like the simplicity and the ability to reason about it. Sure FORTH has problems of its own, but it's always nice to use. I've hacked up a couple of simple FORTH-like systems over the years, most recently this one which was inspired by a thread on this site: https://github.com/skx/foth https://github.com/skx/foth A lot of people go through guides of writing a lisp, I'd love to urge people to try writing a simple FORTH interpreter instead, or even something somewhat related such as TCL.
- codr7 5y agoSecond that, starting with Forth allows getting to the interesting parts faster. Once they're not interesting anymore, Lisp is the next step. https://github.com/codr7/ampl https://github.com/codr7/ampl
- whartung 5y ago> A lot of people go through guides of writing a lisp, I'd love to urge people to try writing a simple Forth interpreter instead, or even something somewhat related such as TCL. See, that's the problem. Writing a Forth interpreter, to be blunt, is not writing in Forth. You should be writing applications in Forth, not interpreters. It's great to marvel at the simplicity of a Forth interpreter, until you have to use it in anger for an actual application. I've made several semi-serious "hobby" stabs at working with Forth, and, for me, it's a tough row to hoe. I look at something like F83 and marvel that someone was able to pull that off in that environment. I simply don't think I've used it enough and cross the line where I'm not constantly fighting...something to get anything done and thus my projects (or my patience) get derailed and I move on to something else. I've never gained any real momentum. F83 is actually quite robust (given it platform), and while gForth and such are better, it's not THAT much better. The core language is the same, though there are some more utilities. My Pooh brain may simply not be able to cope with it properly. Could just be me. But a lot of Forth practitioners are kind of tired of all the "Look I have my own Forth" posts, vs actual working code doing something interesting besides Yet Another NEXT. The Forth "enthusiast" community reminds me of the Pharo community. A community focused on writing Pharo to write Pharo, rather than applications on top of Pharo. They're constantly rewriting something (and making great strides!), but in the end you just get a great tool for making a great tool, and nobody (it seems) is making actual projects with it. A lot of folks get a lot of "stuff" done using all sorts of languages and such, and showcase their wares, with the focus being on the application and the problem they solved. Forth focuses on Forths. And I know this is not universal, folks use it every day in industry and such, and there's even a couple nice videos showing "Forth in action", but much of the notoriety of Forth is the simplicity of the system, rather than the applications written on top of it.
- macintux 5y ago> See, that's the problem. Writing a Forth interpreter, to be blunt, is not writing in Forth. You should be writing applications in Forth, not interpreters. It's great to marvel at the simplicity of a Forth interpreter, until you have to use it in anger for an actual application. I get the impression Chuck Moore would argue "writing in Forth" means designing a custom language and custom hardware in tandem.
- whartung 5y agoForth is one of those systems that blurs the distinction between Application and Language. In truth you push your Application down in to "Forthisms" while uplifting Forth in to your "Applicationisms" and, eventually, like trains in the desert, they meet somewhere in the middle.
- vram22 5y agoSimilar to what Paul Graham wrote about top down and bottom up programming (IIRC, in Lisp), in one of his essays.
- throwaway81523 5y ago> Writing a Forth interpreter, to be blunt, is not writing in Forth. Forth interpreters were traditionally written in Forth, and if you do it that way, that counts imho ;).
- wrycoder 5y agoAs I recollect, Chuck Moore seemed to be unable to write a usb driver in Colorforth.
- progre 5y agoSame here. Inspired by Forth I made a single stack language that I could embed in the narative text for a text adventure game I made as a part of a mystery geocache. The idea was that I would code the interpreter in Python because it's a nice language to get shit done in. Then I would port the code to php for easier hosting. In the end, I never did the php part, I just hosted the python game code on a cheap vps. Had I known I'd end up on that route I would probably just embedded inline python code, but getting my own custom language working was great fun.
- bitwize 5y agoForth is like Lisp's dual. Postfix instead of prefix, no delimiters at all instead of parens out the wazoo, no memory management at all instead of GC, no type system at all instead of dynamic typing. But they both support similar dynamic, interactive, iterative programming styles.
- wrycoder 5y agoNo parameter names instead of hyphenated parameter names.
- joeberon 5y agoForth fans live in what seems to be a world of delusion. They rail against modern software, claiming to have an enlightened "system", and yet cannot communicate anything about the real capabilities of their system. If you ask most Forth users "what do you do in Forth?" the answer is almost always "writing a Forth". There seem to be very few people who are interested in using it for any other problem domain. I can't shake the feeling it is mainly hype.
- michelpp 5y agoNo one here is hyping Forth, they're conversing about and in some cases expressing admiration for what is an amazing and fun little language. Some FORTH systems can fit into less than 10 kilobytes of memory. FORTH was invented in 1968, and was first used outside of Moore's lab by 1970. I could only wish one of my works was still being trash-talked on HN 53 years from now! You can't pay for that kind of "hype".
- fouc 5y agoForth is a notorious "write-only language", it's hard to decipher what your code is doing after you've written it. As someone that spent a couple of years dabbling in forth before moving on to Ruby, I became a lot more appreciative of the sheer readability of Ruby, and ruby-inspired languages like coffeescript & elixir. However I still have a soft spot for the ethos of Chuck Moore. Abstractions are something that we should be wary of as programmers.
- joeberon 5y agoI tried it, and it felt more like a fantasy computer game, like TIS-100 or something, rather than a real language. It felt neither easy to write nor read, and I'm not sure what problem it solves with "software" in general that other languages don't. Ruby is a great language for sure, and actually it has some of the DSL capabilities of Forth
- fouc 5y agoYeah that's one of the most intriguing parts of Forth I thought, the everything-is-a-DSL, the metaprogramming, the language-is-a-bytecode-VM, etc. I feel lisp is very similar, an inverted sort of forth, I've never tried lisp but it seems to be a much easier language to work with than forth.
- Zababa 5y ago> This use of color further reduces the syntax, or punctuation, needed. It also makes explicit how the computer will interpret each word. As always when colorForth is mentionned, I'm personally colorblind so I'm glad stuff like that isn't more popular. The red takes me a long time to parse, especially if I don't know the part is supposed to be red. There is a value in plain text.
- 7thaccount 5y agoCharles Moore was once criticized for this and he pointed out you could just use font instead I think. Keep in mind he generally builds these things for himself based off of his own needs. I can't remember if this is default for the GreenArrays chips though, so perhaps that doesn't hold in all situations.
- Zababa 5y ago> Charles Moore was once criticized for this and he pointed out you could just use font instead I think. I think that would be terrible too but people seem to love their fancy fonts, italics and ligatures, at least in the JS world, like here https://miro.medium.com/max/1200/1*hE_nLB776KUDXPERE_3cXw.png https://miro.medium.com/max/1200/1*hE_nLB776KUDXPERE_3cXw.pn.... I honestly don't see the point and find it harder to read but to each their own. > Keep in mind he generally builds these things for himself based off of his own needs. I can't remember if this is default for the GreenArrays chips though, so perhaps that doesn't hold in all situations. This was more of a general comment about the idea.
- 7thaccount 5y agoAh gotcha. I recalled someone getting upset about it being difficult for those reading code via braille (iirc) or maybe they weren't upset, but were just asking about it lol.
- Zababa 5y agoOh no I'm not upset at all, in a way I find the idea very cool, adding a dimension to code with a visual indicator is a great idea. But as someone that would be badly affected by it, I'm glad it's not done.
- 6d65 5y agoThere's a twitch streamer(tsoding) doing a FORTH like language from first principles. I've watched a couple of episodes and went started my own. I learned a bit of arm64 assembly, and now I have both an interpreter and a compiler to M1 binaries. Very fun experience. One day I'll slap a F#/OCaml'esque syntax on top of it with typed functions, structs, interfaces and see if it works. At their core(it seems to me), concatenative languages are about function (words) composition. So, instead if having "words", I would make them functions, with typed arguments, and simple argument matching (no more dups and swaps). This would probably make the language less flexible, but will make it more readable. Anyway, FORTH is nice.
- qsort 5y ago> So, instead if having "words", I would make them functions, with typed arguments Interesting idea. Wouldn't it require some compiler magic, though? E.g. you can't type a Y combinator.
- 6d65 5y agoMaybe I'm not using the proper FP function term. I don't mean functions as objects that you can store or pass around or higher order functions. Just take some arguments from stack, and return some values. What I mean is that FORTH words seem to be functions taking stuff from stack and pushing stuff back. The composition is done by chaining them together. This probably works fine with repl driven development(same as in lisp), you find out during development that your words cannot be composed. But as mentioned by others it may make the code hard to read, having to keep the state id the stack at all times in your head. I was thinking just adding a light syntax, ex: let add a b = a b + // optional type annotation let square a = a a * let add-square = add square Maybe add some type inference, support for structs, match expressions. But at the core keep the low level FORTH nature, with an interpreter and compiler. It remains to be seen if it's possible to reach a balance here. FP programmers may be disappointed this is not a proper FP language, while FORTH programers may say it's a syntax ridden abomination. I would say with some tooling (editor support, test framework, god forbid package manager), it can be an interesting option for embedded development.