5 ms·
Probably not. It turns out that it doesn't map to modern computer processors terribly well. It's an amazing and elegant language, but anything that does regist
by Gordonjcp 3y ago
Probably not. It turns out that it doesn't map to modern computer processors terribly well.
It's an amazing and elegant language, but anything that does register-to-register operations is always going to be faster than register-to-memory.
- slavapestov 3y agoStack code can be mapped to register code trivially if you impose some restrictions (each word has a static effect and both branches of a conditional have the same effect). Then lowering to SSA form performs an “abstract interpretation” where evaluating a word pops SSA values from a “abstract stack”, creates an SSA node and pushes its output values on the stack.
- vanderZwan 3y agoI wouldn't say that sounds trivial exactl... > slavapestov ... ok, fair enough: it probably is trivial for you, lol. (For the uninitiated: Slava Pestov created Factor, a modern concatenatvie language which (IIRC) did a lot of innovative stuff regarding optimizations in that domain) [0] https://factorcode.org/slava/ https://factorcode.org/slava/
- carapace 3y agoHa! Whenever I work on compiling Joy code I have to fight the urge to just write Joy-in-Factor and lean on all that crunchy goodness. (I wrote Joypy (mentioned in TFA), now Thun (someone took Joypy on PyPI so I renamed it) which includes interpreters in C, Nim, OCaml, and Prolog. I made a few feints at compiling Joy so far, but it's just kid's play compared to Factor. "I am but an egg.")
- lenkite 3y agoHe was the author of the jEdit editor too.
- jacquesm 3y ago> Probably not. Probably yes.
- Gordonjcp 3y agoIn which case, I'm sure you can give some examples.
- jacquesm 3y agoIs Google down again? Bummer. FORTH is still used to bring up new silicon because of its tiny core, you only need a couple of working assembly instructions to bootstrap yourself into a working system, you could do this entirely in cache or a small static RAM if you don't have a working memory controller yet. It is also used all over the place in embedded controllers, https://arduino-forth.com/ https://arduino-forth.com/ , http://www.piclist.com/techref/microchip/language/forths.htm http://www.piclist.com/techref/microchip/language/forths.htm , https://github.com/nimblemachines/muforth https://github.com/nimblemachines/muforth , from PICs to ARMs and everything in between. You won't see a lot of hype around it and repos tend to be old because they 'just work', typically a user of such a system would download it and customize it to the point that sharing it would be pointless, the whole idea is to extend the language to become the application.
- Gordonjcp 3y agoDid you forget what the OP asked? Is anyone using Forth in production? I very much doubt it.
- jacquesm 3y agoYou are probably using it yourself, right now. You just don't realize it because embedded stuff isn't sexy, won't make it to the blogosphere and just sits there doing it's job, year after year. Every vehicle, every boot of a larger machine probably uses FORTH at some stage. Not everything is web based and not everybody is part of the hype cycle. Since you're asking 'anyone' one example should be enough to satisfy you with proof: every IBM Power series system has Open Firmware on it which you can boot into: https://www.ibm.com/docs/en/power9/0009-ESS?topic=asmi-powering-system-off https://www.ibm.com/docs/en/power9/0009-ESS?topic=asmi-power... . Note that that doesn't even mention Forth by name. Also note that the world is a lot larger than just the English speaking part of it, and that bringing up new systems is usually transitory: as soon as you can bootstrap yourself out of a FORTH environment you do so because it is a bit limiting. Finally, as long as https://en.wikipedia.org/wiki/Chandra_X-ray_Observatory https://en.wikipedia.org/wiki/Chandra_X-ray_Observatory Chandra is still online at least someone is using FORTH in production. It's just one of many space missions where FORTH plays a role.
- astrobe_ 3y agoThere's a bunch a vendors still alive, mainly the historic Forth, Inc. and MPE. Both publish complete systems and native compilers that apparently perform well enough. If raw execution speed was all that matters, I can name a bunch of popular programming languages that wouldn't have survived long enough to be saved by JIT, or to become to big to fail (that is, their ecosystem).