6 ms·
The 4tH compiler
- haolez 8y agoForth is the most interesting programming language that I’ve ever encountered. It’s the opposite of being opinionated, to a degree that it hurts :)
- ddingus 8y agoWhere Forth really shines is bootstrapping something really novel. Take an entirely new CPU. A reasonable Forth kernel can be written in as little as 1k assembly code, obviously dependent on said CPU instruction forms and sizes. Once that is done and one has working serial comms, upload a dictionary at it and get a full featured environment quickly. Then, write system dependent words in assembly to complete the basic picture and get stuff done. I have seen skilled Forth users do this kind of thing in a day.
- kabdib 8y agoYeah, FORTH is really good at this. You can start exercising stuff at the hardware level in just a few hours. It's fantastic for system bring-up, and I've used it several times for this. FORTH is terrible at scaling to large systems, though. It's also terrible at hard real-time tasks (like games) or anything requiring much in the way of data structures (FORTH's memory management is about as primitive as you can get).
- jacquesm 8y ago> It's also terrible at hard real-time tasks (like games) I can't agree with you there. In fact, Forth was originally conceived to control a telescope.
- kabdib 8y agoThe telescope application was not very demanding real-time. It basically did slewing control, and you have sufficient overhead to do that in BASIC; milliseconds don't matter very much. Telescopes are a classic example of FORTH's success; the problem comes when you try to extrapolate from that into other problem areas. The attempts I've seen to make FORTH work in a real-time game have all ended in failure. There are technical reasons for this (high cost of inner interpreter overhead, lack of dynamic memory allocation, program structure that makes it difficult to work in large teams) as well as social ones (mostly lack of objective evaluation of quality, and other immature engineering practices).
- ehaliewicz2 8y agoDynamic memory allocation seems like something you'd generally want to avoid in real-time programs and games. Slab allocation is often used (I think that's the right term, allocate a large chunk of memory at startup, bump a pointer to allocate, reset the pointer to free all memory at once), and that's simple to implement in Forth. If inner interpreter overhead is an issue, there are well known solutions to that as well. Subroutine threading removes the inner interpreter entirely, and makes it simple to implement inlining in the compiler, and then there's always the inline assembly approach.
- Someone 8y agoFYI: it’s region, zone, arena, area, or memory context (https://en.wikipedia.org/wiki/Region-based_memory_management https://en.wikipedia.org/wiki/Region-based_memory_management), not slab. ‘Slab allocation’ is an implementation strategy for a ‘normal’ memory allocator, where each block gets freed individually (https://en.wikipedia.org/wiki/Slab_allocation https://en.wikipedia.org/wiki/Slab_allocation)
- ehaliewicz2 8y agoI thought I might have been wrong, but didn't bother looking it up. Thanks.
- Someone 8y ago
- ddingus 8y agoForth can do real time. That does require a bit more kernel.
- ddingus 8y agoAs for structures... It all depends on what words you want to define and whether they must operate on the stack or not. Words do not have to always work from stack. High complexity is entirely possible. I have seen that done too.
- ehaliewicz2 8y ago> It's also terrible at hard real-time tasks (like games) Why? I can't think of any reason that this would be the case.
- jungler 8y agoForth was used for a few commercial games in the 80's(e.g. Starflight), but game programming tends towards getting knee-deep in a statically allocated global state with a large, bespoken update procedure, both of which run contrary to Moore's preferred style of Forth(small word sizes, most things on the stack). So relative to macroassembers, the obvious competitor, most of the potential in Forth can't be usefully realized without reframing it as a metaprogramming tool that emits an assembler binary(In which case - you are going for high level abstraction. There are languages that give you lots of those without effort on your part.) Forth does excel at low memory usage, but the gains are only realized when you don't have a static allocation driving things. Game scenes and most real-time code are statically allocated because statics will allow you to "deliver on what you promise" - if memory is maxed out, the system still hits its deadlines.
- ehaliewicz2 8y agoI guess what you are saying is that while forth is capable, it doesn't really give you anything over using assembler for low-level programming. And if you want high-level abstraction, you can always use C anyway.
- armitron 8y agoI am not sure in which universe games can be described as hard real-time tasks but it's surely not the one we live in. Either way, it's laughable to say that Forth is terrible at hard real-time (see NASA link below). The rest of your arguments are also similarly terrible which makes me question your familiarity with Forth. Here is NASA using Forth: https://www.forth.com/resources/space-applications/ https://www.forth.com/resources/space-applications/
- astrobe_ 8y agoI had to lookup "opinionated" to make sure I understand this statement correctly... Forth is on the contrary very opinionated. When you want to implement something in Forth, you have to take into account it's very limited ability to support complexity. Which forces you to think about the problem until you can code a simple enough solution for Forth. It's a severe limitation, but it's one of the rare cases where a limitation is actually a feature. Forth forces its opinion about simplicity on you and that's a good thing in my opinion, because people tend to underestimate the exponential nature of complexity growth: adding a parameter to a procedure at least doubles the amount of unit tests you have to perform on it; add three parameters and that's a 8x the tests. But it also makes Forth far less fit for task where handling nightmarish complexities is the main topic. If you can't cut the Gordian knot, you lose.
- bunderbunder 8y ago> But it also makes Forth far less fit for task where handling nightmarish complexities is the main topic. If you can't cut the Gordian knot, you lose. Maybe in a monolithic program. But I could see successfully tackling some very complex problems with a swarm of Forth programs that are individually very clean and simple. That sort of approach is presumably one of the basic ideas behind Green Arrays.
- mepian 8y agoVLSI design is pretty complex, yet Chuck Moore figured it out in mere 500 lines of Forth and successfully manufactured chips designed with his own tools: https://colorforth.github.io/vlsi.html https://colorforth.github.io/vlsi.html
- kristianp 8y agoBut who uses it except Chuck? And is that page the only documentation?
- boomlinde 8y agoIn the sense that there are no types (or only one, depending on how you look at it), that its inventor eschews standardization, that there are literally no keywords and that the basic premise of the language is that it, the interpreter, the application and the compiler are the same thing, it's not at all opinionated. You make an interesting point, but what you describe is about the only sense in which I'd respect calling Forth opinionated. In every other sense, walking into a new Forth application is potentially like walking into a new language. As a good example of how unopinionated it is, here are the jonesforth implementations of the IF and THEN words: : IF IMMEDIATE ' 0BRANCH , HERE @ 0 , ; : THEN IMMEDIATE DUP HERE @ SWAP - SWAP ! ; Don't need those words? Don't implement them and make your own branching abstraction. Feel like you spend too much time juggling the stack? Implement named parameters and local variables. Need records or structs? Do it. Need an object system? Go for it.
- tambourine_man 8y agoSomeone forgot to test the site on a larger than 1600px screen. background: url(whitenote.jpg) #fffffa; background-repeat: repeat-y; For the fix
- 21 8y agoComment from the website source code: // sometimes when the user reloads the document Netscape 3.01 does not trigger the onLoad event Netscape 3.01 was released in 1996 The JavaScript code is also commented out, in case the browser doesn't know what JavaScript is.
- tambourine_man 8y agoYeah, iframe aside, I actually like layout from those days. Skeuomorphic spiral notebook was all the rage
- phpnode 8y agoPretty sure this is a Windows chm file exported as html
- attende_domine 8y agoInteresting home page https://thebeez.home.xs4all.nl/ https://thebeez.home.xs4all.nl/
- yvoschaap2 8y agoI remember that 199X trend, where you would re-create an FBI warning: orange tape, gif of a spinning warning light, etc. Expect this to be the same era joke.
- echeese 8y agoClick the 'o' in Enforcement
- simonebrunozzi 8y agoWow. How did you find it? Thanks for sharing the tip.
- lake99 8y agoRepeatedly hit the Tab key. It's likely you'll see 'o' link getting outlined.
- HocusLocus 8y agoEmbedded image USEMAPs make me feel old. I remember when you couldn't even reliably support them in all web browsers. For each clickable image map you also needed a GET/POST form 'CGI' program that was passed only relative image coordinates of the click and had to decode it server side.
- hhh 8y agoRedPower for Minecraft was a mod that introduced computers that used Forth. It was really interesting. I loved it.
- astrobe_ 8y agoSome "nutjob" did something like that in Minetest too: https://github.com/minetest-mods/turtle https://github.com/minetest-mods/turtle
- garganzol 8y agoI tend to love the website aesthetics. It has some quirks but hierarchical presentation of information is hard to beat. The guy's writing style is amusing as well. Thumbs up for the great find.
- floatboth 8y agoIs this one related to the '4th' that was used in the FreeBSD boot loader? (very very recently Lua became the default)
- StefanKarpinski 8y agoThe very first thing I navigated to is Contents > Profile > The Beez' which starts with: > "I don't hate women. I just feel better when they're not around." I don't know who this is quoting—presumably "Beez"—or why, but this is an awful first impression.
- Lerc 8y agoIt changes on each view to a different misogynistic comment. That extra effort does not bode well.
- utam0k 8y agoThis is very interesting.