3 ms·
I use it for scripting and as an embedded debugging language for other programs. For instance I wrote a logging program that collects log messages sent by vari
by astrobe_ 10y ago
I use it for scripting and as an embedded debugging language for other programs.
For instance I wrote a logging program that collects log messages sent by various sources via UDP, displays them in colours on the console and records them in different log files. It is also a HTTP 1.1 server that I use to monitor a few key data about the logs from a browser on an other machine.
The right way to use Forth nowadays is, in my humble opinion, as a template to build yourself your own interpreter that does exactly what you want (as long as you know how to do it ;-), because it has a very low barrier-of-entry implementation-wise.
The "Forth is good for embedded stuff" pitch becomes less and less true every year, because embedded micro-controllers become more and more powerful. Other small languages like Lua are becoming "good enough" on these and are more "user-friendly".
Extrapolating from myself I would say that those who stick with Forth are just liking it and/or like to have absolute control over their tools.
- Someone 10y ago"It is also a HTTP 1.1 server" You may have mostly implemented one of the things on my list of "ridiculous things I would like to see": a forth-based web server that accepts code URLs. For example GET foo.com/2/3/+/. would return a text file containing the number '5', and GET foo.com/:/square/dup/*/; would define a new function (technically, that should be a PUT, but who cares, for a ridiculous idea?) Of course, this should follow the forth philosophy, so URLs like GET foo.com/forget/forget would work 'fine'. Connecting such a contraption to the internet might not be the brightest idea, but I think it can be made (more or less) safe by executing every request from within a highly restricted vocabulary. I would guess that's how you implemented your http request handling, but likely only for one-word URLs. If so, the rest is just a REPL that uses slashes as word separators, so it is easy to write.
- yellowapple 10y agoFaaS: Forth as a Service. I love it.