2024-12-30 00:24:56 veltas: not reading K&R I’ve been readinga book called “Effective C” 2024-12-30 00:25:58 Forth just seemed easier to reason about and debug I guess 2024-12-30 00:26:19 I can just print the stack to check my work 2024-12-30 00:31:13 I originally started with the Crafting Interpreters book, but it was too much overload for me with operator precedence and parsing infix and stuff 2024-12-30 00:31:28 So I followed Peter Norvig’s Lisp tutorial in Python 2024-12-30 00:31:33 But I wanted to go simpler 2024-12-30 00:35:21 The Collapse OS project seems really cool, the author has tutorials on implementing Forth in ASM but I’m not quite ready for that yet :P 2024-12-30 00:36:10 so far Virgil seems reasonably friendly, too 2024-12-30 00:37:45 Yeah I emailed him and he responded really quickly and positively 2024-12-30 01:07:31 veltas: thanks for the link, interesting take — I’m still reading through Thinking Forth 2024-12-30 01:23:18 moving forth is probably also worth a look 2024-12-30 01:23:25 explains a bunch of different threading styles 2024-12-30 01:25:39 I’ll check those out 2024-12-30 07:37:20 I've now got the beginnings of a business case for Forth in my head 2024-12-30 09:00:58 a what? 2024-12-30 09:01:19 soweli_iki: toki pona! 2024-12-30 16:18:37 Seabass_: If you want to learn more about Forth internals I think the best book for that is Forth Fundamentals by McCabe. Volume 1 exposes pretty much everything about how it was done back then (it's pretty old). Volume 2 is a "glossary" that gives the Forth definition of a whole bunch of high level words. That's kind of obvious in a lot of cases, but in a few it shows some nifty techniques. 2024-12-30 16:18:53 It's out of print, but people have seemed able to find it online. 2024-12-30 16:19:22 It basically old FIG Forth style, pre-standard. 2024-12-30 16:19:56 And the model it describes is an indirect threaded one, which was the "original" way it was done. The other threading styles emerged later on. 2024-12-30 16:34:02 What is the difference between direct and indirect threaded code? 2024-12-30 16:36:01 https://www.bradrodriguez.com/papers/moving1.htm has some stuff on these threading models 2024-12-30 16:36:55 "Direct Threaded Code differs from ITC in only one respect: instead of the Code Field containing the address of some machine code, the Code Field contains actual machine code itself." 2024-12-30 16:39:15 it's all tradeoffs about execution speed and memory usage 2024-12-30 16:39:26 generally direct threaded uses more memory but is faster 2024-12-30 16:40:04 token threaded is the other way 2024-12-30 16:40:24 Huh so direct threaded stores all the operations “inline” whereas indirect threaded stores a pointer to the function 2024-12-30 16:40:33 So I would be doing indirect threaded then 2024-12-30 16:40:37 read jonesforth 2024-12-30 16:40:46 it has some good diagrams of ITC 2024-12-30 16:40:48 I am assuming Token threading is what I’m doing rn just storing the strings 2024-12-30 16:40:54 I don’t know asm 2024-12-30 16:41:02 Yet 2024-12-30 16:41:11 token threading is where you store a number instead of a pointer 2024-12-30 16:41:27 I’m storing strings but same kinda thing 2024-12-30 16:41:30 say you're on a 32 bit system but you don't want to store an entire 32 bit pointer for every function 2024-12-30 16:41:41 you could store a 16 bit token instead 2024-12-30 16:41:52 which still gives you room for 65536 functions 2024-12-30 16:41:56 ie. more than enough 2024-12-30 16:42:05 you need to indirect through a lookup table or something though 2024-12-30 16:44:28 Ah ok 2024-12-30 16:44:40 That’s what I do is just lookups but with strings 2024-12-30 16:48:00 I like how we've between us recommended like 4 different massive texts to Seabass_ over one small question 2024-12-30 16:48:25 jonesforth isnt that long 2024-12-30 16:51:22 moving forth's sections on itc & dtc aren't really massive 2024-12-30 16:54:54 If you don't know what one to read you'll end up spending ages reading 2024-12-30 16:56:58 But I would also recommend Moving Forth to someone who wants to understand the different threading models 2024-12-30 17:22:20 Usually if something is beyond me, I can kinda tell and skip it 2024-12-30 17:22:36 Some stuff you can tell just requires prerequisite knowledge 2024-12-30 17:23:00 Like, I only can understand the different explanations of indirect vs direct vs token threaded because I’ve been implementing one myself 2024-12-30 18:24:32 i would also plug moving forth. i started with jonesforth, even took some cues from it to try rolling my own, but nothing helped it all "come together" for me like brad rodriguez's moving forth articles 2024-12-30 18:25:30 they're very short and have nice pictures. don't skip parts because you think it's beyond you. if you're stumped, study it, ask questions, and try to understand it. 2024-12-30 18:25:51 or skip with the intention of returning later 2024-12-30 18:26:16 i usually read things in several passes. i find that i grok better when i know the destination. 2024-12-30 18:28:05 or take a walk or something so the brain can work on the problem in the background 2024-12-30 18:38:38 veltas: i'm still waiting to hear how you're going to make us all rich 2024-12-30 19:06:12 Pay me and I'll double your money ;) 2024-12-30 19:07:26 there's always the Superman 3 method 2024-12-30 19:08:01 Unfortunately I don't have floating point in my Forths usually 2024-12-30 20:04:19 The first step is watching this important safety video https://www.youtube.com/watch?v=7yrv505R-0U 2024-12-30 20:08:53 Seebass_: Yeah, that's how I've approached physics. I finished graduate school in engineering back in the early 1990s, and have bascially had an interest in physics ever since. I've ever so slowly built up a pretty decent understanding by doing just what you say - I read, or watch videos, or whatever, and just glaze over things I can tell I'm not ready to absorb yet. Bit by bit I get ready, and 2024-12-30 20:08:55 maybe years later I eventually "get" those bits. 2024-12-30 20:09:31 I think it's a pretty good skill to have - makes it so being spoon fed isn't the only way you can learn. 2024-12-30 20:10:38 I think if indirect threading is the first thing you learn (like it was for me) it's then fairly easy to pick up direct and subroutine threading. Going the other way might feel a little more abstract. 2024-12-30 20:19:20 Yeah at some point you have to get your hands dirty to build that mental model so you can build on top of it 2024-12-30 20:37:41 I spent several decades building Forth systems that I then hardly ever used, beyond convincing myself they worked. The last couple of times, though, I've actually worked them out a bit more. Still mostly in ways you could regard as "further system development" rather than applications, but at least I got around to actually writing a fair bit of Forth. 2024-12-30 20:38:36 Time before last I had this idea for "conditional return" primitives, and I wound up quite liking them. So much that I generally don't even put the usual conditional control structures in my systems anymore. 2024-12-30 20:38:56 I'm quite sure that the resulting code is tighter. Shorter definitions, more factoring, etc. 2024-12-30 20:39:26 I start to squirm if a definition tries to get longer than 50 chars or so. 2024-12-30 20:40:21 I wind up with these little "paragraphs" - eight or ten or twelve little short definitions which all conspire to accomplish whatever it is I'm trying to do. 2024-12-30 20:40:57 I've gotten so I can look at one of those on my screen and regard it as a single unified entity. 2024-12-30 20:42:35 Usually only one or two of those definitions gets used later - the rest of "helpers," and I've evolved a nice little way to mark those so that I can purge them from the dictionary. I define them using a word .: instead of : and later run a word that just snips them all out of the search chain. 2024-12-30 23:19:17 the thing with "lots of short functions" is why would you write a function you only call once 2024-12-30 23:48:20 crc do you use vnc for your tablet + termux 2024-12-30 23:48:40 I guess you still use a tablet + termux as main dev env? 2024-12-30 23:48:52 Yes. Still using a tablet , 2024-12-30 23:49:12 I do use VNC when I occasionally need to do graphical stuff 2024-12-30 23:49:29 Mostly I just run in a text terminal though 2024-12-30 23:50:11 I see that pulseaudio just works which is kind of cool 2024-12-30 23:50:28 are you fine with what termux repo provides or you use proot-distro? 2024-12-30 23:50:57 I use proot-distro since I can just pretend I have a debian environment and works most of the time 2024-12-30 23:51:56 https://i.imgur.com/1JvyB7G.png 2024-12-30 23:55:13 Just plain termux 2024-12-30 23:56:07 I guess you have enough since termux repo provides a lot, but with proot distro you use the arm repo of the system you emulate, which being debian is a lot more 2024-12-30 23:56:18 I mostly just run my forth system, so don't need much else