2022-06-28 01:17:12 hi all - i mentioned my rpn experiments with rust previously - took it a bit further and now have it running with wasm and xtermjs - http://geminidev.hopto.org/hettie/~pi/rrpn/ (enter help to see current dictionary) 2022-06-28 09:42:08 what's the difference btwn an eek and an erd ? 2022-06-28 09:45:30 01 < g e^e^k vs < n e^r^d 2022-06-28 10:24:51 a few days ago, I asked about advises about fun Forth things here 2022-06-28 10:24:54 for publishing an article 2022-06-28 10:25:02 and the article is out: The Gopher Times 5 2022-06-28 10:25:50 - gopher://bitreich.org/1/tgtimes/ 2022-06-28 10:25:52 - https://gopherproxy.net/bitreich.org/1/tgtimes/ 2022-06-28 10:26:11 Not gopher:// ? 2022-06-28 10:26:34 Get with the times. Everyone's using gemini now. 2022-06-28 10:26:42 lol that'll teach me not to read the backscroll fully 2022-06-28 10:27:32 boru: the topic of Gemini is very welcome here too 2022-06-28 10:28:16 dlowe: that was for whoever not having a gopher client at hand 2022-06-28 10:28:31 curl supports gopher:// since long :) and netcat too 2022-06-28 10:28:50 (just printf '%s\r\n' "$path" | the query in it) 2022-06-28 10:29:03 I suppose openssl s_client can do the same regarding gemini:// 2022-06-28 10:31:36 Should be fine, yeah. 2022-06-28 11:10:34 got me to look at retroforth 2022-06-28 11:11:07 several gemini clients also support gopher, at least lagrange and elpher, anyway 2022-06-28 11:27:18 Nyxt supports both - I should know, I helped contribute! :) 2022-06-28 11:45:19 retroforth's uses of anonymous functions (quotes) are pretty inspired. `[ 'true s:put ] if` is much prettier than IF..THEN metacompilation hackery 2022-06-28 11:47:51 same goes for `[ ... ] repeat` and `[ ... ] while` - just simplicity itself 2022-06-28 11:49:41 yeah, I'm exclusively doing those too 2022-06-28 11:50:32 https://git.sr.ht/~remexre/rtf/tree/trunk/item/src/prelude.fth#L107 (and L160-192) 2022-06-28 11:58:24 Looks like there are numerous ways to avoid that IF ... THEN hackery. I don't have those in my system either, but I don't do anonymous functions either. 2022-06-28 11:58:33 I do it all with conditional returns. 2022-06-28 11:58:44 And conditional recursion. 2022-06-28 11:59:07 And I'm convinced its considerably more "compact" in terms of overall code. 2022-06-28 12:01:09 I could be convinced of this 2022-06-28 12:06:42 Hmm, i disagree that quotes are simpler 2022-06-28 12:08:01 implementationwise, that is 2022-06-28 12:13:47 I'm pretty sure simple { and } words are not significantly more complicated than IF and THEN, in terms of the metaprogramming involved 2022-06-28 12:13:55 (thinking of a DTC implementation, at least) 2022-06-28 12:14:50 : { ['] JMP COMPILE, HERE 0 , ; IMMEDIATE 2022-06-28 12:15:08 : } HERE OVER ! CELL + LITERAL ; IMMEDIATE 2022-06-28 12:15:18 something like that? 2022-06-28 12:15:27 (my actual implementations are more complicated and allocate) 2022-06-28 12:16:06 if you wanted to make the compilation easy, you add an unresolved jump, compile the quote as usual, then compile the address literal, then resolve the initial jump 2022-06-28 12:16:16 not the most efficient thing 2022-06-28 12:18:48 ya, that's what I did above 2022-06-28 12:19:16 tho what i did above doesn't quite work ig 2022-06-28 12:19:39 forgot the code field 2022-06-28 12:21:15 it'd be better during runtime to be able to compile the quote recursively in its own area to avoid the jump but then you've ruined the simplicity 2022-06-28 12:21:55 ya, that's what i do in my real implementation 2022-06-28 12:22:11 how do you handle nested quotes? 2022-06-28 12:22:35 compiler has dynamic memory allocation 2022-06-28 12:22:56 yeah, that's a far cry from the usual bump allocation of most forths 2022-06-28 12:25:10 yeah, I'm doing something closer in complexity to qbe or llvm than to most forths; this forth is meant as a compile target as much as a user-facing language 2022-06-28 12:27:17 (and I haven't ever implemented a lot of "classical" compiler optimizations before, and kinda wanna try building some DSLs for them that compile to this forth; especially a small datalog engine) 2022-06-28 12:27:37 nice :) 2022-06-28 14:41:59 eris: I've never done quotes, so I can't really comment. It doesn't actually "feel" like it would be simple, though. 2022-06-28 14:42:58 dlowe: And yes, to the extent I have thought of it it seemed like putting it inline and jumping over it would be the simplest path to it. 2022-06-28 14:43:07 But slightly less desirable, as you noted. 2022-06-28 14:43:51 I guess it's probably not "too" non-simple, done that way. 2022-06-28 14:44:14 And compared with the usual IF THEN, maybe about the same? 2022-06-28 14:44:57 I think the conditional returns are even simpler - they're just ordinary words. No extra hoop jumping at all to build stuff that way. 2022-06-28 14:45:04 inlining it and jumping over prevents certain things 2022-06-28 14:45:15 mm, true 2022-06-28 14:45:31 Conditional recursion takes just a tiny bit of extra diddling. 2022-06-28 14:46:16 it's just a conditional branch back to the beginning 2022-06-28 14:46:22 You at least have to go find your most recently defined word. 2022-06-28 14:46:38 Yes, sure. But you do have to go look that up. 2022-06-28 14:47:03 But any implementation of tail recursion requires that too. 2022-06-28 14:47:26 Do you? Just store the pointer to the head during compilation and use that 2022-06-28 14:48:08 Fair enough, but that's "extra." Beyond standard compilation I mean. It's barely any extra, I agree, but it is. 2022-06-28 14:48:28 okay. I couldn't remember if that was already stored or not 2022-06-28 14:48:30 I'm picking nits. 2022-06-28 14:48:41 there are a lot of little variables used during compilation like HERE 2022-06-28 14:48:48 Well, it's pointed to by CURRENT. Or something related to it is. 2022-06-28 14:48:54 It's easy peasy to do. 2022-06-28 14:48:56 No doubt 2022-06-28 14:49:20 You have to have that info somewhere in order to be able to properly extend the linked list. 2022-06-28 16:42:18 KipIngram: how do you do a multiple dispatch under that model? Like I have something that can be four values and I want to do a different thing for each 2022-06-28 16:42:49 I'm not quite sure what you mean - you mean like a switch statement or something? 2022-06-28 16:42:53 yeah 2022-06-28 16:43:44 I'm not challenging the idea just trying to understand how it would work in practice. 2022-06-28 16:44:10 Yeah, I don't actually have a word for that, but if I were to add one it would take an integer argument and would just jump forward that many cells. Most likely I'd factor that structure into a word of its own, and then would have the words in the option list do a double return. 2022-06-28 16:44:24 : foo switch bar bam boom ; 2022-06-28 16:44:43 bar, bam, and boom would double return, so bar and bam wouldn't fall through to the following options. 2022-06-28 16:45:08 swtich would just skip n cells. 2022-06-28 16:45:41 But there's not really an easy way that I've seen to do that with *clauses* of codes instead of single words of code. 2022-06-28 16:45:53 quotations might help with that, actually. 2022-06-28 16:46:17 Generally rather than try to define chunks of code anonymously, I just name them and have done with it. 2022-06-28 16:46:58 But I'd usually use my .: word to define them, which means I could later drop all the names from the dictionary, after I'd compiled the stuff that used them. 2022-06-28 16:47:20 .: does the same as :, except it sets a bit in the header. 2022-06-28 16:47:30 .wipe scans the dictionary and unlinks anything with that bit set. 2022-06-28 16:48:11 Forth encourages a lot of factoring, so I think it should offer an easy way to de-clutter the namespace. 2022-06-28 16:48:44 I think overlays are the traditional forth mechanism for that 2022-06-28 16:48:57 Having the names around later, even if they're not in the lists, is nice for decompilation. 2022-06-28 16:51:02 Overlays would move the code in and out too, right? 2022-06-28 16:51:29 A good vocabularly mechanism helps too - you can sequester those "helper words" in a vocabulary. 2022-06-28 16:51:48 sure, but you're talking about moving 1k of code in and out :) 2022-06-28 16:52:14 Sure - I'm generally ok with clever use of disk-resident stuff. 2022-06-28 16:52:34 I've been going through the old Starflight source and it uses overlays a lot 2022-06-28 16:52:41 Forth's mechanism for that is fairly nice, actually. 2022-06-28 16:52:57 I tried really hard to write my BLOCK word so that the "already resident" code path is very very fast. 2022-06-28 16:53:04 As fast as I could make it. 2022-06-28 16:53:12 And that part is a primitive. 2022-06-28 16:53:31 And I have a LOT of disk buffers. 2022-06-28 16:53:47 Seems like a good way to use our modern plethora of RAM, at least in a desktop environment. 2022-06-28 16:54:43 I was amused at the rant in Starting Forth against the terrible trend of storing code in named files of different sizes 2022-06-28 16:54:51 I needed to do a mod 255 operation in that fast part of BLOCK, so I went and found a slick way to do that that's faster than using %. 2022-06-28 16:55:24 just bit-and by #ff, no? 2022-06-28 16:55:32 And yes, I could have made it be 256 instead, but that didn't work as well with my overall planned RAM management. 2022-06-28 16:55:45 oh, 255. hm. 2022-06-28 16:56:05 It's certainly not as fast as mod 256 would be - you can hardly beat that. 2022-06-28 16:56:21 But it's 3-4 times faster than using idiv. 2022-06-28 16:57:17 But I'm keeping those 4k disk buffers in a 1 MB RAM page, and I needed that last 4k for something else related. 2022-06-28 16:57:41 I've got 255 4k buffers, and then 255 "buffer records" that keep up with what's in the buffers, their stale status, etc. 2022-06-28 16:57:50 When it's all said and done I waste 16 bytes of the 1MB page. 2022-06-28 16:58:13 I'm planning a bi-level RAM management scheme, where the "big blocks" are 1 MB. 2022-06-28 16:58:32 That's just going to be a fixed block size allocator. 2022-06-28 16:58:45 The level below that, though, will use ropes to issue out blocks of various smaller sizes. 2022-06-28 16:59:09 One of you guys put me onto ropes a few months ago. 2022-06-28 16:59:43 yeah, ropes are very cool 2022-06-28 18:58:26 Hello! 2022-06-28 18:58:34 hallo! 2022-06-28 19:35:17 Hi pointfree!