2024-08-14 10:58:02 unjust: Sorry we had some network issues 2024-08-14 15:24:31 Is Forth is in use anywhere? 2024-08-14 15:25:25 I remember seenig it in an old book as a modern language compared to C and Fortranc in some drwings. 2024-08-14 15:25:50 Never encountered its name after that until now. Brought back memories. 2024-08-14 15:28:42 https://en.wikipedia.org/wiki/Open_Firmware used it 2024-08-14 15:29:13 Also some NASA craft 2024-08-14 15:29:22 I think most uses nowadays are in embedded systems 2024-08-14 15:30:45 one of my favorite old games for the Mac was written in forth and I never knew until recently 2024-08-14 15:31:07 https://www.forth.com/resources/space-applications/ 2024-08-14 15:31:15 I read that something like 92% of the disk image was pointers from indirect threaded words 2024-08-14 15:32:12 FreeBSD loader 2024-08-14 15:33:02 at least as a scripting option, https://man.freebsd.org/cgi/man.cgi?query=loader&sektion=8 2024-08-14 15:33:51 https://man.freebsd.org/cgi/man.cgi?query=loader_4th&sektion=8 is probably better at a glance 2024-08-14 15:41:38 also some PLC applications like (use a translator) https://es.ua/forthlogic 2024-08-14 15:51:32 Some game used it I heard 2024-08-14 15:51:52 crc uses it professionally 2024-08-14 15:51:54 In here it's mostly just a hobby 2024-08-14 15:53:27 I would need a very compelling reason to invest in it professionally 2024-08-14 16:00:24 Vender lock-in 2024-08-14 16:00:27 Vendor* 2024-08-14 16:00:58 that's compelling :) 2024-08-14 16:01:33 I can't think of any reason, other than personal interest 2024-08-14 16:01:43 Creativity etc 2024-08-14 16:01:45 modern tech can afford to spend a lot of cpu and ram on guardrails 2024-08-14 16:01:46 Not business reasons 2024-08-14 16:02:13 even the embedded space is getting luxurious amounts of ram 2024-08-14 16:02:23 (comparatively speaking) 2024-08-14 16:02:41 In embedded I'd rather use C, can use a lot less ROM/RAM with C than Forth 2024-08-14 16:02:43 now watch the code quality dwindle even further in the coming years 2024-08-14 16:02:55 Unless I'm using it as a powerful assembler 2024-08-14 16:03:01 But then development time is much much higher 2024-08-14 16:03:57 I haven't done my own comparison but I thought forth compacted much better than object code 2024-08-14 16:04:10 Depends on arch 2024-08-14 16:04:16 I will say that if I wanted some very low level code that also needed to be portable, I might reach for forth 2024-08-14 16:04:35 There's no modern embedded archs that are much denser than Forth 2024-08-14 16:04:41 just for the number of underlying words I would have to redefine 2024-08-14 16:04:42 much larger I mean 2024-08-14 16:05:01 historically forth has never supported recursion, right? 2024-08-14 16:05:57 Yeah it has 2024-08-14 16:06:03 there's a recurse word for it 2024-08-14 16:06:27 Older Forths had different ways of making words visible while they were being compiled 2024-08-14 16:06:42 More hacky but possible 2024-08-14 16:06:54 The term "smudge bit" comes to mind :P 2024-08-14 16:08:09 oh the recurse word, right 2024-08-14 16:09:00 The oldest ref to Forth I have seems to use a model that supports recursion 2024-08-14 16:09:20 not sure if there's any benefit at all over just having a loop in your word? 2024-08-14 16:09:21 Being the "problem oriented language" paper or whatever it's called 2024-08-14 16:09:49 Since Forth is very stack-based, no there's no benefit in Forth 2024-08-14 16:10:23 Unless you want actions on other end? 2024-08-14 16:10:23 So there is benefit I guess lol 2024-08-14 16:42:35 Yup 2024-08-14 18:09:35 siak: re: "Is Forth is in use anywhere?", a couple of examples from my current/past projects are listed at http://forth.works/share/HoM0qVZ00t.txt 2024-08-14 18:13:58 crc: thanks for sharing this! 2024-08-14 18:14:20 crc: how much byte-munging did you have to do yourself for stuff like http and image formats? 2024-08-14 18:14:25 you can even do mutual recursion in Forth; the classic stupid example is 2024-08-14 18:14:41 defer odd : even dup 0= if drop 1 else 1- odd then ; :noname dup 0= if drop 0 else 1- even then ; is odd 2024-08-14 18:15:25 it just occurred to me that you could do trivial tail-call optimization by jumping to the last word in a definition instead of calling it 2024-08-14 18:15:39 yes, that's what ColorForth does 2024-08-14 18:15:40 assuming there was one 2024-08-14 18:16:03 I'm not sure if that's ANS-compliant what with the different return stack effect 2024-08-14 18:17:23 Colorforth has a word -: for turning the call to the previous word into a jump 2024-08-14 18:17:33 Er, -; 2024-08-14 18:18:16 note though that my odd/even example above only does tail recursion and wouldn't be helped by turning the lexically last word into a jump 2024-08-14 18:25:26 if you rewrite it like this: 2024-08-14 18:25:51 defer odd : even dup 0= if drop 1 else 1- r> drop odd then ; :noname dup 0= if drop 0 else 1- r> drop even then ; 2024-08-14 18:26:06 it becomes tail-recursive and still mostly works 2024-08-14 18:26:20 but you can no longer type 53 even . 2024-08-14 18:26:25 you have to type 2024-08-14 18:26:26 53 even 2024-08-14 18:26:27 . 2024-08-14 18:26:40 in the outer interpreter 2024-08-14 18:27:18 dlowe: images were a lot of work. I'll be redoing a lot of this in the not-too-distant future using my current systems. 2024-08-14 18:27:35 crc: which image formats did you write support for? 2024-08-14 18:28:07 http isn't too bad. I stopped with basic http/1.1 support though, so there's still a lot that I didn't actually do on that 2024-08-14 18:28:37 for http://canonical.org/~kragen/sw/dev3/server.s I just did HTTP/1.0 2024-08-14 18:30:45 I needed 1.1 for vhost support 2024-08-14 18:31:41 a slightly older copy of my server: https://retroforth.org/examples/Casket-HTTP.retro.html 2024-08-14 18:32:15 for images, I mostly work with BMP, XBM, and XPM formats, though I've done a little with PNG in the past 2024-08-14 18:32:33 that makes sense 2024-08-14 18:32:41 BMP, XBM, and XPM aren't bad at all 2024-08-14 18:33:08 I wrote a BMP output function in Python on a ferry across the river once 2024-08-14 18:33:28 but that's less of a brag than it sounds like because it was the Rio de la Plata 2024-08-14 18:33:47 so I was on the ferry for 4 hours 2024-08-14 18:39:20 I wrote a PPM output for my current project. 2024-08-14 18:39:45 (Because it's arguably the simplest possible output format). 2024-08-14 18:40:04 yeah, PPM P6 is also pretty great that way 2024-08-14 18:40:20 also SVG for output 2024-08-14 18:44:47 xentrac: interesting approach to writing macro-laden assembly, and nice be macro - did you ever consider getting it to test if src is within {b,w,l} bounds for mov suffix selection post-clear-by-self-xor? to shave off a few of those immediate zero-padding bytes? 2024-08-14 18:48:04 thanks! 2024-08-14 20:28:40 there are clearly constant values for which that would be a win 2024-08-14 20:28:49 I don't think I ever thought of that 2024-08-14 20:57:08 we should have a Forth IRC bot that evaluates Forth 2024-08-14 21:00:09 xentrac: somebody wrote one once. But it self-destructed, erasing its own code. The last string in the log was "A real forth programmer would code their own bot, not use somebody else's." 2024-08-14 21:32:06 lispmacs[work]: haha 2024-08-14 23:31:32 xentrac: we've tried this a couple of times, many years back. It never really got used. 2024-08-14 23:48:53 2024-08-14 23:50:20 lispmacs[work]: lol... Nice. 2024-08-14 23:52:08 crc: hmm, what other kinds of problems did people run into? 2024-08-14 23:56:18 not really any problems (when a little work was done to prevent full host system access & endless looping things), but in the ~20 or so years I've followed this channel, none of them ever really got used for anything useful 2024-08-14 23:58:13 I'm open to having one in the channel again, but it probably won't be something I develop/run 2024-08-14 23:59:22 I have thought about writing a documentation bot, that could return information about words from various standards/implementations 2024-08-14 23:59:59 IRC bots often have the problem of being inherently kind of silly