2023-05-05 00:01:12 unjust: what are you planning to do with that forth in js? 2023-05-05 00:01:54 decay: don't you have your own forth currently? 2023-05-05 00:02:02 Not really. 2023-05-05 00:02:09 and not willing to? 2023-05-05 00:02:21 I have many languages. I haven't found a favorite. 2023-05-05 00:02:40 I enjoy a lot making a toy language 2023-05-05 00:03:33 I'm trying to find something I can just settle down in for a few years. 2023-05-05 00:03:43 and being able to implement my own language in any other language is a cool feature 2023-05-05 00:03:51 I'm having... considerable difficulty. 2023-05-05 00:03:54 I can steal a lot of stuff 2023-05-05 00:05:39 for php makes more sense to make a transpiler 2023-05-05 00:05:42 vms14: not sure, draw on a canvas probably 2023-05-05 00:05:52 but I don't like it 2023-05-05 00:05:53 vms14: maybe generate svg 2023-05-05 00:06:08 unjust: I was going to start adding canvas bindings 2023-05-05 00:06:22 my goal is to make a simple game 2023-05-05 00:07:01 but wanted to make a todo app, as it's like the next program after a hello world 2023-05-05 00:08:59 I think my favourite lang has become my own language 2023-05-05 00:13:25 a few years ago, part of a customer information display system that i built had an in-browser feature that used a canvas element (plus javascript) to allow a user to generate an overlay definition (featuring dynamic text + graphics sourced from other data providers, in JSON) on top of a JPEG/PNG image 2023-05-05 00:13:56 it had a nice grid + vert/horiz line guidance system with auto-snapping 2023-05-05 00:14:26 i would like to recreate something similar without javascript getting in the way this time 2023-05-05 00:15:06 :0 2023-05-05 00:15:12 I want to see the code when you do it 2023-05-05 00:15:18 the code in your forth 2023-05-05 00:17:04 sure, if i ever get around to that, i'll show you 2023-05-05 00:17:10 :D 2023-05-05 00:21:02 decay: wouldn't a language implemented by you be enough to settle on? 2023-05-05 00:21:26 for example if you do like crc, making a vm, it would be quite portable 2023-05-05 00:21:35 not with that greener grass being right over there 2023-05-05 00:21:44 which means you can benefit from almost every language 2023-05-05 00:22:13 yeah and it's almost summer, there's a lot of bugs 2023-05-05 00:23:06 vms14: I've implemented everything from tiny concatenative languages, to term rewriting languages that are suitable for hardware synthesis. 2023-05-05 00:23:37 so you can't decide on which kind of language to implement? 2023-05-05 00:23:56 There are caveats with all of them. But I have a model that I'm happy with, I just need to put a method of programming into it. 2023-05-05 00:24:27 what are the caveats of concat langs more than stack juggling? 2023-05-05 00:24:54 I miss optional arguments, it forces me to use lists, but it's doable 2023-05-05 00:25:06 My requirements are pretty strict, in that things as basic as numbers aren't included. 2023-05-05 00:25:48 do you have documentation on some of those langs? 2023-05-05 00:26:12 The caveats of concatenative languages is that you have two flavors: you have languages like Joy, and languages like Forth. Forth always assumes some underlying machinery, and things need to "look" like a traditional von Neumann machine. 2023-05-05 00:26:39 Joy is more symbolic, but you need quotations, which are more complex than you'd think. 2023-05-05 00:27:07 So you have this duality between wanting to be symbolic, far away from a specific machine architecture, and being very close to a specific machine architecture. 2023-05-05 00:27:40 There's a gradient between the two. 2023-05-05 00:28:17 The same can be said for most languages/models of computation. 2023-05-05 00:28:37 my lang does not even know what the machine is 2023-05-05 00:28:49 You either have machinery following an instruction graph or symbolic manipulation that warrants reduction steps. 2023-05-05 00:29:02 I have not been happy with either. 2023-05-05 00:31:24 I think I'm getting closer to what I want, though. I have a model that functions as a model of concurrency, a model of capabilities (security-wise) and a method of modeling mobile agents. 2023-05-05 00:31:43 I just don't have a programming method for the agents. 2023-05-05 00:31:59 decay: That's really interesting. In a way, we could view both term rewriting and assembly are both languages implemented in their respective metalogics. 2023-05-05 00:32:32 xelxebar: One's mind starts focusing on the modeling overhead of each method. 2023-05-05 00:32:48 And it really comes out in something like sending a running program over the network. 2023-05-05 00:33:11 If I wanted to lift a running program from my machine to another machine, _while it's running_, I need to transmit three things. 2023-05-05 00:33:34 The memory that the program is using, the program memory that the program code exists in, and the program counter. 2023-05-05 00:34:16 That's assuming a traditional VM. But, what happens if I change the model? Let's assume I have a bunch of term rewrite rules, with one large term as my program state. 2023-05-05 00:34:38 The number of things I need to transmit, now, is just 2: the list of term rewrite rules, and the term under rewrite. 2023-05-05 00:34:52 The state of the "program" is just the current term. 2023-05-05 00:35:56 What if you go further, to something like Joy? I could send a quotation across a network after composing it with its required arguments, so that when it's evaluated, it "unpacks" itself and starts running. All of a sudden, the number of things I need to transmit drops to 1: the code I want to run. 2023-05-05 00:36:14 The number of conceptual objects matters. 2023-05-05 00:36:38 yeah, but somehow giving the memory feels more powerful 2023-05-05 00:36:55 it could send a program while it's running 2023-05-05 00:37:02 The latter two do the same thing. 2023-05-05 00:37:10 stopping before send, and resuming once it arrives on the other machine 2023-05-05 00:37:17 That's.. what all of them do. 2023-05-05 00:37:45 giving code is not as giving the state of the whole program 2023-05-05 00:37:46 There are likely clear mechanical transformations between the different models, but I gather you're focusing more on the "conceptual weight". Is that true? 2023-05-05 00:38:10 vms14: I'm not giving code. I'm giving code + state. 2023-05-05 00:38:23 It turns out that in the latter two, you can start merging them. 2023-05-05 00:38:33 then it should be the same as with memory the code is part of the state itself 2023-05-05 00:38:33 xelxebar: Yeah. Conceptual weight would be a good way to put it. 2023-05-05 00:38:46 Because conceptual weight translates into implementation weight. 2023-05-05 00:40:07 Interesting. How base conceptual models impact downstream maintenance and dev costs is something I've been starting to cognate concretely about lately. 2023-05-05 00:40:49 It becomes pretty expensive. 2023-05-05 00:41:12 Even something as trivial as word size in a VM impacts things like algorithm complexity unless you stick with high word sizes. 2023-05-05 00:41:28 we are rich in resources 2023-05-05 00:41:38 is the only way I can be rich 2023-05-05 00:41:41 We are gluttonous with resources and cannot plan for usage. 2023-05-05 00:41:56 I want to know the concrete memory footprint of 20,000 agents, for example. 2023-05-05 00:42:13 But I can't do that if the internal model of those agents includes dynamic memory allocation (implicit or explicit). 2023-05-05 00:42:33 agents as in the actor model? 2023-05-05 00:42:39 No. 2023-05-05 00:43:00 Running pieces of code that can interact with some surrounding environment via synchronous communication methods. 2023-05-05 00:44:08 APL is actually pretty nice in that regard. It affords static analysis of exact memory footprint down to the byte. 2023-05-05 00:45:49 Not just theoretically, even. It's something APLers actually end up doing in practice. I'm still don't grok the precise design decisions of APL as a programming language that manifest such a thing, though. 2023-05-05 00:47:07 Resource planning also allows you to do things like run untrusted code. 2023-05-05 00:47:12 From arbitrary sources. 2023-05-05 00:47:21 If you know an agent takes, say, 32 bytes. 2023-05-05 00:47:38 You can say that an assemblage of them coming from some network location is only allowed to be 300 agents wide. 2023-05-05 00:52:26 Trust models are certainly important, but that seems like a pretty orthogonal issue. Just as mutual cooperation in the prisoner's dilemma leads to better outcomes than defecting, defaulting to adversarial models incurs pretty high costs. 2023-05-05 00:53:56 In this case, giving hard upper bounds on memory usage is a much weaker guarantee than *also* having tight lower bounds as well. 2023-05-05 00:54:55 Why? 2023-05-05 00:55:29 The assumption that any code that runs on your machine will be malicious isn't exactly something divorced from reality. 2023-05-05 00:55:39 Especially if you accept it from any source. 2023-05-05 01:08:59 Depends on what you're doing. I'm imagining that you're designing a language with concurrent agents. Building in adversarial semantics means that I have to pay the cost of guardrails even in cases where I'm the one controlling all agents. 2023-05-05 01:09:56 Within-aplication agents usually go out of their way to cooperate, and we only need to cordon off specific ones, like those that handle user input or whatever. 2023-05-05 01:10:23 That is, unless your threat model is really hard, and you want to be extremely cautious :D 2023-05-05 01:12:13 Anyway, I'm just making a descriptive statement, not a normative one. Adversarial agents cost more overhead than cooperative ones. It makes sense to ask when and where you want to spend that cost. 2023-05-05 08:48:15 This is a great read about TCL https://yosefk.com/blog/i-cant-believe-im-praising-tcl.html 2023-05-05 08:48:39 And it's about how useful it can be with embedded work, and I think that a lot of what's praised here applies to Forth as well 2023-05-05 08:50:28 and later thishttps://yosefk.com/blog/my-history-with-forth-stack-machines.html 2023-05-05 08:50:30 also 2023-05-05 08:50:45 i think it was here that tclforth got linked, right? 2023-05-05 08:52:21 Well I seem to remember he doesn't like Forth 2023-05-05 08:53:08 My point in linking the article is just that it helps illuminate slightly why languages like Forth and Tcl have good syntax/features for something interactive 2023-05-05 08:53:26 aye 2023-05-05 08:55:12 Also they were wondering how to achieve something as 'nice' in an infix language, well Haskell didn't get mentioned. I think Haskell's syntax is a good effort at removing unncessary commas and parentheses 2023-05-05 08:55:39 From a language with more strong syntax, rather than just shell-style "everything is a string" syntax 2023-05-05 08:58:40 drakonis: yes, i think someone linked to https://github.com/wejgaard/TclForth 2023-05-05 09:00:10 the Expect library for TCL is an underappreciated tool for automation 2023-05-05 09:01:04 the TclForth creator's Holon* projects are pretty interesting 2023-05-05 09:01:28 surprisingly smalltalk-ish 2023-05-05 09:30:05 TCL: what if a shell was bitten by a radioactive lisp 2023-05-05 09:31:23 Ugh. Controversy in the reddit community I help moderate. 2023-05-05 09:31:57 A couple of folks posted AI generated arwork, in the "Fan Art" category. They got reported for copyright violation, and now there's a big stew brewing about the issue in general. 2023-05-05 09:32:20 which one? 2023-05-05 09:32:30 On the grounds that those engines scrape existing artwork online, and thus violate the rights of the creators of that art. 2023-05-05 09:32:48 notice how the little people get the copyright violation notices, not le googles 2023-05-05 09:32:48 Midjourney on the first one. Different engine on the second. 2023-05-05 09:33:04 Yeah. 2023-05-05 09:33:24 Well, no one is arguing that punitive action should be taken against the people that produced the images. 2023-05-05 09:33:37 The critics just want us to ban AI art from the community. 2023-05-05 09:34:10 It's an issue I'd just never previousl given any thought to. 2023-05-05 09:34:25 I actually didn't even know Midjourney existed until this came up. 2023-05-05 09:34:26 its not /r/art, is it? 2023-05-05 09:34:48 No, it's /r/dresdenfiles. Aimed at a particular urban fantasy series. 2023-05-05 09:34:52 ah yes. 2023-05-05 09:35:18 AI art has interesting consequences such as ending the trade of being an artist 2023-05-05 09:35:25 It's not an activity I'd have expected to find myself engaged in before I started, but I've had a good time helping out. 2023-05-05 09:35:28 that's just an AI bot being a great artist, isn't it? stealing instead of copying? 2023-05-05 09:35:29 (its a really bad consequence) 2023-05-05 09:35:39 Yeah, it's a thorny issue for sure. 2023-05-05 09:35:53 And is going to be a lot more widespread than just art in the long run. 2023-05-05 09:37:29 i doubt AI art is going to kill human (or other lifeform?) rendered art, there'll always be people who want to support other people in creative endeavours 2023-05-05 09:38:17 the consequence is that less people commission art because of it 2023-05-05 09:38:51 why pay someone when you can feed the AI what you want until you get the desirable results 2023-05-05 09:39:01 creative endeavours... how's that going... https://www.eff.org/deeplinks/2023/01/have-you-tried-turning-it-and-again-rethinking-tech-regulation-and-creative-labor#main-content 2023-05-05 09:39:19 the advent of photograpy had the same effect, it didn't kill off the portrait and landscape artists altogether 2023-05-05 09:39:38 Sure. PowerPoint did it to some fraction of the "graphic artist" biz. 2023-05-05 09:40:45 Lot of technology has had this sort of effect. Early in the industrial revolution people would sabatage machinery because they felt like it destroyed jobs (which it did). 2023-05-05 09:42:01 a) work 14 hour days in factory b) starve to death 2023-05-05 09:42:07 things evolve and people adapt, new vocations appear to fill the void inevitably 2023-05-05 09:44:49 yes, though you have horrid things like hollywood execs wanting to use chatgpt to generate scripts 2023-05-05 09:44:50 That's the hoped for result, yes. I'm not sure it's an inexhaustible resource, though. 2023-05-05 09:45:05 because the writer's guild is on strike 2023-05-05 09:47:42 if they blindly rely on the output of artificial intelligence, i'd agree that's pretty terrible. but what if they use it as augmented intelligence instead and edit/extend/redact the generated script to their liking? 2023-05-05 09:47:42 the difference between the industrial revolution and AI is that AI replaces an inherently creative endeavor 2023-05-05 09:49:02 the machines sped up repetitive work during the industrial revolution 2023-05-05 09:50:21 it was less safe yet you still needed underpaid humans to operate the machines 2023-05-05 09:50:25 AI as it stands is just a fuzzy search over a corpus. It can't replace creative endeavors, only regurgitate and mix the end results of creativity and hand that mixture back to you. 2023-05-05 09:51:14 exactly that 2023-05-05 09:51:51 it is inherently dependent on existing human creations to output its data 2023-05-05 09:52:14 The only "surprise" is that the granularity got better. Take voice generation for example. 2023-05-05 09:52:41 Given a sentence, and a person's voice profile, generate an audio file of the person saying the sentence. 2023-05-05 09:52:42 if it somehow managed to make it impossible to live off art, it would have less data to work off 2023-05-05 09:52:44 Well, you might argue that the industrial revolution replaced "inherently skilled" labor. 2023-05-05 09:52:50 it did not 2023-05-05 09:52:56 I'm not sure the nature of the ability makes a lot of difference. 2023-05-05 09:53:29 At one point we relied on, essentially, sentence mixing by picking out words from the chunks of audio of that person. 2023-05-05 09:53:45 And stitching them together and applying postprocessing to them. 2023-05-05 09:53:50 Yeah, I've heard of people using AI to generate voices, which they then use to contact someone's parents and ask for emergency money to be sent. 2023-05-05 09:53:52 To make one word flow into the next. It sucks. 2023-05-05 09:53:59 My wife read about it in an article a week ago or so. 2023-05-05 09:54:36 Flash forward a couple of years, it got more granular: instead of vowels, you can now do it with phonemes. 2023-05-05 09:54:40 I figure we'll get to the point where photographic evidence is no good in court anymore. 2023-05-05 09:55:00 Courts have provenance, that hasn't changed. 2023-05-05 09:55:16 Chain of custody of evidence always will be a thing. The photographic evidence had to come from somewhere. 2023-05-05 09:55:40 just wait, someone will try and sell the idea of an AI judge + jury 2023-05-05 09:55:41 But, on voices, now we've gone from phonemes to sub-phoneme construction. The only thing that's improved over that span of time is granularity. 2023-05-05 09:55:42 Well, but take security camera footage or something. Yes, it's in a chain of custody after it's first secured. 2023-05-05 09:55:48 But there's no telling where it came from. 2023-05-05 09:56:42 unjust: At least one state is already using AI to determine criminal sentences. 2023-05-05 09:56:52 There are nuances that make that less likely. For one, security camera footage comes from security cameras. So there are audit logs, access logs, etc. 2023-05-05 09:57:05 don't need AI for that. poor? throw 'em in jail 2023-05-05 09:57:06 And when a defense attorney requested to study the source code, the request was denied. 2023-05-05 09:57:17 If someone had that level of control over a security system and had enough training data to fake footage, they wouldn't even need AI. 2023-05-05 09:57:20 KipIngram: sentence duration only? 2023-05-05 09:57:33 I don't know that detail. 2023-05-05 09:57:49 It was somewhere up in the farm belt - been a couple of years since I read about it. 2023-05-05 10:12:33 actually with AI you might get rid of the competent judges and replace them with kowtowing flunkies 2023-05-05 10:12:56 oh yes. 2023-05-05 10:13:00 lots of potential for abuse 2023-05-05 10:13:16 https://twitter.com/AlexBlechman/status/1457842724128833538 2023-05-05 10:13:25 an evergreen tweet 2023-05-05 10:14:06 It's the kind of thing I would have just never believed would even be considered earlier in my life. 2023-05-05 10:14:43 But new generations come along and just don't have the same "core principles." 2023-05-05 10:14:47 thrig: ...you mean like the thing that's already happening? :P 2023-05-05 10:15:45 shush! 2023-05-05 10:16:11 KipIngram: What do you mean by "core principals"? 2023-05-05 10:16:12 this is some, uh, hypothetical future dystopia we would never be so foolish to dabble with 2023-05-05 10:16:38 Or, rather, what principals are you talking about specifically. 2023-05-05 10:17:09 Um, well, just things that we'd fundamentally not want to give up, like the right to trial by jury of our peers. AIs wouldn't be our peers. 2023-05-05 10:17:39 I'm pretty sure nobody wants to be tried by an AI... 2023-05-05 10:17:55 Intergenerationally. 2023-05-05 10:17:59 Back some years ago I saw some girl in a news interview. No one particular, just a "face on the street." And she actually said outright "This freedom of speech thing has got to go." 2023-05-05 10:18:08 I nearly fell out of my chair. 2023-05-05 10:18:16 And, how old was that girl. :P 2023-05-05 10:18:24 Oh, young, but voting age. 2023-05-05 10:18:29 Young as in.. 2023-05-05 10:18:37 That's what I mean about new generations coming along. 2023-05-05 10:18:44 Twenty? 2023-05-05 10:18:58 And some years ago would be, what, a decade? 5 years? 2023-05-05 10:19:04 6-7. 2023-05-05 10:19:14 Well, 7 years ago, I was 20. 2023-05-05 10:19:23 I'm pretty sure it's not a generational thing. 2023-05-05 10:20:08 Fair enough - I wouldn't want to imply that it's a universal thing. And I'm sure you could have found someone much earlier. But it was just a shocking thing to hear on the news. 2023-05-05 10:20:10 7 years ago was 2016, which was just the beginning of the social erosion of our country. 2023-05-05 10:20:13 Of course, "shock" is what they go for. 2023-05-05 10:20:49 That's a separate problem - the tendency of the news to focus on sensation instead of "best truth." 2023-05-05 10:20:57 If you ever want to understand Russia's actions on the world stage... https://en.wikipedia.org/wiki/Foundations_of_Geopolitics#Content 2023-05-05 10:21:05 There's always been yellow journalism. 2023-05-05 10:21:11 But these days it's practically all yellow. 2023-05-05 10:21:39 And I've watched that happen during my life. 2023-05-05 10:21:54 I'd call it green journalism, as in the color of money. And the Russians pay well. 2023-05-05 10:22:35 Anything profit driven will optimize itself for the largest market share. 2023-05-05 10:22:40 That's fair too - yellow is just a euphemism that's been around for a long time. 2023-05-05 10:22:49 But yeah, money is part of it too. 2023-05-05 10:23:01 I mean, they go yellow because they decide that makes more money. 2023-05-05 10:23:08 I'd say money is the only driving factor. Shock value means attackment. 2023-05-05 10:23:11 *attachment 2023-05-05 10:23:30 It taps into the cyclical expectation-reward system. 2023-05-05 10:23:44 I'm willing to believe that money is the ultimate root cause. 2023-05-05 10:23:59 If you can deliver shock value that's ideologically pleasing to the reader, you have a hooked market. 2023-05-05 10:24:03 Yellow journalism is a "behavior." And probably motivated by money. 2023-05-05 10:24:16 Hence, Fox, Newsmax... 2023-05-05 10:24:26 And so on. 2023-05-05 10:24:36 I don't know one that remains immune to this. 2023-05-05 10:24:42 No big one, at least. 2023-05-05 10:24:47 Agreed. 2023-05-05 10:25:01 My wife thinks the Wall Street Journal is better than most. 2023-05-05 10:25:10 But I haven't read it, so I don't have an opinion there. 2023-05-05 10:25:25 The fact that it's incentivized even at the lower levels, i.e on individual reporters to find a "scoop" (which is a trope that's been around for longer than either of us), is a problem. 2023-05-05 10:25:34 Yes. 2023-05-05 10:25:49 But that's a symptoms of seeking markets. 2023-05-05 10:25:53 *symptom 2023-05-05 10:25:59 fingers, brain, get together and figure it oout 2023-05-05 10:26:03 I think the internet and "deep conversation" podcasts and so on are our best option these days, but you can't consume just one. 2023-05-05 10:26:04 *out, damnit. 2023-05-05 10:26:12 You need to consume a bunch of them, across the spectrum. 2023-05-05 10:26:17 And then think about things yourself. 2023-05-05 10:26:34 I would really rather we just report things that happened rather than also offering accessory perspective. 2023-05-05 10:26:42 The Fairness Doctrine needs to come back. 2023-05-05 10:26:50 Would suit me. 2023-05-05 10:27:34 I did find a news website that was just data, graphs and so on 2023-05-05 10:27:37 When I was in college I made a point to watch the NBC news every evening. Just to keep up with the world. As the years went by that became a waste of time. 2023-05-05 10:27:56 What year? 2023-05-05 10:27:59 Or, rather, years. 2023-05-05 10:28:09 I've given thought to writing my own "AI" news scraper. 2023-05-05 10:28:20 I'm imagining you weren't in college during the Reagan years. 2023-05-05 10:28:22 Just to gather multiple sources up into one place. 2023-05-05 10:28:29 Or post-Reagan. 2023-05-05 10:28:39 I was, in fact. 2023-05-05 10:28:44 1981-1985. 2023-05-05 10:28:46 like https://ground.news ? 2023-05-05 10:28:53 ooooo just before it got revoked. 2023-05-05 10:29:15 1987. 2023-05-05 10:29:20 sorry for butting into the conversation 2023-05-05 10:29:26 That sounds about right. 2023-05-05 10:29:38 nmz: No problem, man, it's not like we're on topic or anything here. 2023-05-05 10:29:40 1440 is also a sort of aggregator or news scraper 2023-05-05 10:30:03 Part of that desire is just to try my hand at that kind of AI. 2023-05-05 10:30:09 "DIY" mentality. 2023-05-05 10:30:21 Plus I'd run it in console. 2023-05-05 10:31:57 someone made a summary AI thing but they charge for the API 2023-05-05 10:45:59 would be great if you could slap [citation needed] on most of the news out there 2023-05-05 10:46:55 or ignore it, as it's mostly shocking and/or depressing 2023-05-05 10:47:37 i'd bet there'd be less garbage out there, if (for the most part) the journalists had to divulge the sources of their info 2023-05-05 10:48:54 Probably, but there are downsides of that too - it would be a tradeoff. 2023-05-05 10:57:25 So, I'm running a drive test at the moment that uses 2.85:1 compressible data - I write enough of it to fill the drive 50% full physically. 2023-05-05 10:57:37 Normally I format before such tests, but I forgot this time. 2023-05-05 10:57:56 It's not really a problem - the previous data on the drive also filled 50% of it and was 1:1; it will all get overwritten. 2023-05-05 10:58:07 But it is kind of interesting to watch the fill percentage as this happens. 2023-05-05 10:58:26 It goes down from 50% at first, as some of the 1:1 data is overwritten with 2.85:1 data. 2023-05-05 10:58:44 It will go down for a while and then start going back up, and will go back to 50% in the end. 2023-05-05 10:59:33 I've often wondered why we don't have drives that have hardware compression. 2023-05-05 10:59:52 This drive does. 2023-05-05 11:00:05 ... 2023-05-05 11:00:08 show me 2023-05-05 11:00:14 I know kung-fu! 2023-05-05 11:00:29 LOL. 2023-05-05 11:00:36 https://www.ibm.com/docs/en/flashsystem-9x00/8.2.x?topic=overview-flashcore-modules 2023-05-05 11:01:13 The biggest one holds 38.4 TB physical. You could put 100 TB or so of English text on it. Palm of your hand. 2023-05-05 11:01:47 Jesus. 2023-05-05 11:01:56 Yeah, it's pretty impressive. 2023-05-05 11:02:12 What kind of algorithm do they use? 2023-05-05 11:02:13 We don't sell it standalone - we put it in rackmount products that we build. 2023-05-05 11:02:19 You can get a box with 48 of them. 2023-05-05 11:02:24 2U rack box. 2023-05-05 11:02:26 I keep forgetting you work at IBM. 2023-05-05 11:02:46 Does it compress at rest or compress in-stream? 2023-05-05 11:02:55 On the fly. 2023-05-05 11:03:04 Damn. 2023-05-05 11:03:13 I'm even more interested in the algorithm. 2023-05-05 11:04:18 I don't "know it" to any extent. I can ask about it and see what aspects of it might be sharable. 2023-05-05 11:04:52 I'm even more impressed with the error detection and correction hardware, though. 2023-05-05 11:05:10 This QLC flash is crap - it develops bit errors over time just sitting there. 2023-05-05 11:05:39 But we have a background process running that scans through all the written data (takes a week or two to get to all of it), reads each page and counts the errors. 2023-05-05 11:05:54 When that rises above a certain threshold, we re-write that page to a new location. 2023-05-05 11:06:03 Sets the error count back to zero. 2023-05-05 11:06:16 We don't let pages accumulate more errors than the algorithm can correct. 2023-05-05 11:06:43 So you can't turn these boxes off and walk away for a month or anything like that - they need to be running all the time. 2023-05-05 11:07:19 Gross. 2023-05-05 11:07:20 When a page starts developing errors at too high a rate, we retire it. 2023-05-05 11:07:30 We're just moving to battery backed SRAM by the day. :P 2023-05-05 11:07:34 Yeah, sometimes I describe it by saying that we make armor out of tissue paper and spit. 2023-05-05 11:07:57 We start with this problematic flash substrate, and wind up with enterprise grade data storage. 2023-05-05 11:08:09 actually paper/glue armor is pretty good 2023-05-05 11:08:13 It is actually fun work. Not that I actually do the development work. 2023-05-05 11:08:27 I can imagine! I wouldn't wanna use it, but the work itself sounds fun as hell. 2023-05-05 11:08:35 (or can be pretty good, if you do it right) 2023-05-05 11:08:44 I do performance testing, which involves enough "understanding" of the innards that I'm able to keep my developer pallete wet enough. 2023-05-05 11:08:46 Most of the time. 2023-05-05 11:09:08 It's like all this stuff has its own laws of physics. 2023-05-05 11:09:25 It really does. 2023-05-05 11:09:43 I'd like to make my own flash-based storage box one of these days. 2023-05-05 11:10:19 It would never be something I could sell, though, because I'd build things into infringed, most likely. 2023-05-05 11:10:24 into it 2023-05-05 11:10:30 into it that 2023-05-05 11:10:31 Ugh. 2023-05-05 11:10:57 fingers are lagging behind my brain this morning. 2023-05-05 11:11:57 Anyway, I talk at times with the guy that does the error detection and correction FPGA. Really fancy stuff, involving polynomial fields and so on. 2023-05-05 11:12:26 Oh hell yeah. 2023-05-05 11:12:46 I'll definitely see if I can at least find out what general family of compression algorithms we draw from. 2023-05-05 11:12:54 I'm sure it "starts out" as something well known. 2023-05-05 11:13:09 With minor touches being added in, I'm sure. ;) 2023-05-05 11:13:24 Yeah, which I probably won't even get to know about. :-) 2023-05-05 11:13:29 The "secret sauce." 2023-05-05 11:13:56 I wonder, given the battery technologies we have now, if it'd be possible to build a battery-backed SRAM drive. 2023-05-05 11:14:03 We're not the fastest drive on the block. Samsung makes drives that outrun us by a fair margin. But they're much lower capacity. 2023-05-05 11:14:05 With similar capacities. 2023-05-05 11:14:25 There is some kind of drive that is basically that. 2023-05-05 11:14:35 I'm trying to think of the algorithm. 2023-05-05 11:14:56 And part of what our box level software does is let you mix a few of those in with the flash drives, and it runs a "tiered" storage system on all that. 2023-05-05 11:15:03 Keeping the hot data in the faster drives. 2023-05-05 11:15:10 Smart! 2023-05-05 11:15:27 That's mostly what these boxes are - a big bag of small smart things. 2023-05-05 11:16:02 Then some additional caching is done with ram directly in the box, rather than packaged as drives. Even faster. 2023-05-05 11:16:08 But still less capacity. 2023-05-05 11:16:24 I was wondering if there was a hot RAM cache. 2023-05-05 11:16:42 Yeah, but my work doesn't expose me to the box level. 2023-05-05 11:16:47 I do single-drive testing. 2023-05-05 11:17:46 So I put drives in a Linux host, and run open source storage testing tools. 2023-05-05 11:18:12 I don't use the Linux nvme driver, though - I replace it with a third party thing from Intel that has a lot less overhead. 2023-05-05 11:18:57 I'm not really interested in that overhead at all, so the lower I can make it the better. 2023-05-05 11:20:00 A few years ago there was a bit of a flap because my single-drive performance numbers were coming in 10% or so higher than the single drive performance "extracted" from system level tests. 2023-05-05 11:20:22 And some big shots started watching and wanted to know why we weren't getting my measured performance in the system. 2023-05-05 11:20:45 Turned out it's because I only run one CPU thread per PCI port - that thread doesn't have to contend for it. 2023-05-05 11:20:55 The system runs a whole bunch of threads, and they have to share. 2023-05-05 11:21:09 Once I did a test to emulate that setup, I measured the same thing they did. 2023-05-05 11:21:24 Bahahahaha. 2023-05-05 11:21:30 But the system is trying to run 48 drives, not just one. 2023-05-05 11:21:47 So it pretty much has to use all the cores and they have to share all the drives - there's really no way around it. 2023-05-05 11:22:24 Yeah, you're going to get some contention unless you straight up have a 48 core+ CPU.. 2023-05-05 11:22:43 But we at least came to understand the difference - that was good enough for the big shots. 2023-05-05 11:57:25 Is there a forth word to flush (drop) the entire stack? 2023-05-05 11:57:47 bye 2023-05-05 11:58:27 I mean without exiting 2023-05-05 11:58:33 details, details 2023-05-05 11:58:36 heh 2023-05-05 11:59:09 : empty BEGIN DEPTH 0> WHILE DROP REPEAT ; 2023-05-05 11:59:15 is what I have in my pforth.fs 2023-05-05 11:59:20 k, thanks 2023-05-05 12:04:52 there's CLEARSTACK too in some forths 2023-05-05 12:17:58 sp0 @ sp! 2023-05-05 12:18:24 If your Forth is written that way. 2023-05-05 12:20:11 ANS aside, there's a lot of unportability 2023-05-05 12:21:21 Possibly. But that's not as far out in left field as the number format stuff I was talking about yesterday, which I cooked up from scratch. 2023-05-05 12:21:42 Well, it was suggested to me by a friend. But I'd never seen it in a Forth previously. 2023-05-05 12:23:43 That stack stuff I have, and I've also seen it in some books. 2023-05-05 12:23:55 I think it may be of FIG origins. 2023-05-05 12:32:53 Anyway, it has the virtue of being the simplest way to do it. 2023-05-05 12:59:59 I'm torn over whether to store a thread's register values, when it's not running, on its data stack or in some system buffer. I want to think it doesn't really matter much either way. 2023-05-05 13:00:07 But I'm not quite sure of that yet. 2023-05-05 13:00:38 we are the registers of christmas past! 2023-05-05 13:02:18 If I keep them on the stack, then every thread's stack space will have to be sufficient to hold that, in addition to whatever the thread has on the stack. But that space has to be somewhere, so why not there? 2023-05-05 13:03:13 I suppose you could argue that the thread could use that space for itself, so long as it didn't let that condition persist across a thread swap. 2023-05-05 13:03:24 But having the thread be aware of that has its own yuck. 2023-05-05 13:04:18 Ok, my drive just finished overwriting all the 1:1 data - the fill state has started to move back up. 2023-05-05 13:04:43 It pulled down from 50% to 35.5%, and now has turned around and is headed back up about twice as fast. 2023-05-05 13:05:00 On the way down there was a one step up, two steps down thing going on, and now it's two steps up. 2023-05-05 13:05:47 Because the drive has two data connections, and one of those connections was laying down new data on unwritten resources right from the start - it was just the other one that was overwriting previously written 1:1 data. 2023-05-05 13:06:09 Took me a while to figure out when I expected it to turn around, but I did have the right answer before it turned. 2023-05-05 13:18:25 I also want to give these threads a mechanism for communicating with one another - I'm thinking along the lines of those "synchronous communicating processes" laid out in that Rob Pike paper we discussed a few months ago. 2023-05-05 13:18:35 Have to also decide how to implement that. 2023-05-05 13:19:10 Simplest way may be to just endow message pipes with names, and let threads connect to them that way. 2023-05-05 13:19:44 But I want that mechanism to support not just sending and receiving information, but also thread synchronization. 2023-05-05 14:03:31 The simplest way to do this is, effectively, a lock with some additional metadata. 2023-05-05 14:03:59 Synchronous communication means one thread is stuck in `send` until another thread executes `receive`. 2023-05-05 14:04:43 `send` plops down a datum, `receive` grabs that datum and clears the comm channel. 2023-05-05 14:05:15 Yes. 2023-05-05 14:05:54 Pike's paper was good - it seems like a good model for parallelizing certain things. 2023-05-05 14:06:24 He definitely didn't invent synchronous comms, but came up with a calculus that used synchronous comms. 2023-05-05 14:08:31 Yeah, it just happened to be his paper I read. He didn't claim it was his idea - he was more just "promoting it." 2023-05-05 14:08:39 That's one of the things I really dislike about the "actor model": liveness assertions become really, really difficult to ascertain when you allow for asynchronous, unbounded comms. 2023-05-05 14:09:01 Whereas with synchronous comms you can effectively just use TLA or some other temporal logic. 2023-05-05 14:09:27 You always know the threads that'll be alive at some point, because they're just communicating state machines. 2023-05-05 14:10:27 So if they're in a state that they can only exit via some `send` or `receive`, you know they're dead unless another thread is in the same state, communicating over the same port. 2023-05-05 14:12:24 what kind of conventions do you follow on your word names? 2023-05-05 14:13:10 Yes, and the resources that you need for a synchronous pipe are lower. It's either got something in it or it doesn't. You don't need a big buffer like you'd need for asynchronous ones. 2023-05-05 14:13:14 for example I append a * to indicate an alternative version of a word, which usually operates in a different way or taks different arguments 2023-05-05 14:14:02 I append a ~ to indicate a version of a word that does not return some value 2023-05-05 14:14:04 A common relationship you see is foo and (foo) where (foo) winds up being called by foo and performs the real work except accepts an additional parameter. 2023-05-05 14:14:15 like a drop after the word 2023-05-05 14:14:41 Like we were talking about numeric base yesterday, and I mentioned (.) which is basically . but with a base parameter, so that you wind up with : . 10 (.) ; 2023-05-05 14:14:50 KipIngram: Exactly. Annd if you wanted to, you could chain together multiple synchronous pipes to form a queue, where the element at the end, on completion of a `send` to some output port (to the thing using the queued elements), executes a `receive` on a port from the prior element. 2023-05-05 14:15:11 Yeah. 2023-05-05 14:15:11 (This is very effective in asynchronous logic.) 2023-05-05 14:15:28 Asynchronous/clockless. 2023-05-05 14:15:43 I always liked asynchronous logic, but the old saw about it being easy to get yourself in trouble is certainly true. 2023-05-05 14:15:56 But sometimes it can solve problems that synchronous logic can't. 2023-05-05 14:16:12 I forget which class of async logic is TC but I don't think QDI is. 2023-05-05 14:17:22 : >+++:) ." I'm a skeletal fish, indicating something fishy here." ; 2023-05-05 14:17:23 hahaha 2023-05-05 14:17:28 https://www.taygeta.com/forth_intro/ellipses.htm 2023-05-05 14:18:02 https://github.com/ForthHub/discussion/issues/73 2023-05-05 14:22:30 perl -pne 's/foo/oh/ig' 2023-05-05 14:23:16 https://termbin.com/tbwhf 2023-05-05 14:27:22 http://forth.works/demo/ (now loading default image & blocks from server, blocks are cached in ram and can be downloaded/uploaded again) 2023-05-05 14:28:02 mixing -p and -n to perl doesn't make much sense 2023-05-05 14:29:36 yeah forgot p implies n 2023-05-05 14:30:11 not so much implication as they are the opposite of one another 2023-05-05 14:35:57 https://wiki.c2.com/?ForthObjects 2023-05-05 14:36:54 I assume most forthwrights despise objects, as they have a lot of ways to abstract stuff 2023-05-05 14:37:30 but I should add some syntax to create js objects 2023-05-05 14:37:43 as I see there, class could just create a package 2023-05-05 14:39:42 there's one oop system in forth you like? 2023-05-05 14:40:35 javascript required for "measured improvement in server performance" ... lol, wtf wiki.c2.com 2023-05-05 14:44:59 jgaz: The ANS forth word to drop the stack is ABORT , but that also quits out of any running function 2023-05-05 14:45:47 thrig's code looks like a safe way to achieve the same thing if you don't want to quit out of the currently running word 2023-05-05 14:57:46 crc I'm reading the manual 2023-05-05 14:57:48 it's cool 2023-05-05 15:00:42 crc how do you debug your programs in retro? 2023-05-05 15:01:01 when you have an error, what info does retro show you? 2023-05-05 15:01:49 ? 2023-05-05 15:03:54 https://www.reddit.com/r/Forth/comments/7hxgpb/debugging/ 2023-05-05 15:05:17 oh there's a crc comment there 2023-05-05 15:05:28 I do have plans for a flexible debugger, but probably won't actually write it until sometime next year. 2023-05-05 15:05:39 crc that comment is 5 years old 2023-05-05 15:05:42 where's the debugger? 2023-05-05 15:08:07 For RetroForth, it's mostly autospy (examples/autopsy.retro) 2023-05-05 15:10:35 Next release of Retro will have more debugging support. It adds stack checks to the VM instructions, and I'm adding an i/o extension that will allow for running words on specific types of errors and getting more data on the location of errors. 2023-05-05 15:12:07 https://retroforth.org/examples/autopsy.retro.html 2023-05-05 15:12:47 does it make any sense to have unit tests in forth? 2023-05-05 15:13:35 yes? you can write bugs in your 3UP just as easily as in other languages 2023-05-05 15:16:35 The unu format allows for test blocks, though I've not done an actual testing vocabulary yet 2023-05-05 15:17:05 yeah, but it's hard to imagine a forth dev using testing suites when they have tested every line of code they type 2023-05-05 15:17:34 have they? 2023-05-05 15:17:50 They certainly have not. 2023-05-05 15:17:51 I assume a forth dev tests a word when is defined 2023-05-05 15:18:02 That assumption isn't universal. 2023-05-05 15:18:28 and then you refactor and now what? where are the bugs you added? 2023-05-05 15:18:53 would you refactor a word and left it untested? 2023-05-05 15:19:00 leave* 2023-05-05 15:19:26 vms14: what if the words that the "tested" word depends on change their behaviour? 2023-05-05 15:19:34 it's silly not to have a test suite for easily tested things 2023-05-05 15:20:28 unjust: that only happens on my language, unless we talk about state 2023-05-05 15:21:47 https://users.ece.cmu.edu/~koopman/forth/koopman90a.pdf 2023-05-05 15:22:56 you can be a lot more confident about making changes and/or refactoring things when you have a decent test suite written for parts of your program, if it's written reasonably well you can just run it again once you've made any changes to confirm that you haven't broken anything 2023-05-05 15:23:23 well anything you considered important enough to write a test for, at least 2023-05-05 15:23:30 vms14: I test code as I write it, but having tests is still beneficial. 2023-05-05 15:24:40 I want to see in how many ways I can improve debugging and a simple test suite looks like the first step 2023-05-05 15:24:42 The (incomplete) tests I have written have found bugs introduced during later edits 2023-05-05 15:25:49 I'd like also to be able to tell the proper line of the source code when something happens 2023-05-05 15:26:16 but no idea on how to know the line of a loop 2023-05-05 15:26:54 well I need to add much more info to the interpreter 2023-05-05 15:28:06 when I make a program more complex than a hello world I have some troubles debugging 2023-05-05 15:29:05 I suppose I have to make extensive checking on all words, like checking the integrity of the values before using them 2023-05-05 15:30:09 for example words working with lists do not check if the element is a list 2023-05-05 15:32:28 an error/condition system is also interesting 2023-05-05 15:52:42 When Forth is interpreting, you have either typed a line of code at it or it is interpreting source code from a disk block. It knows its offsset within that block at any given time; it advances a counter through there to move through the source. 2023-05-05 15:53:22 When an error occurs, it's not uncommon at all for Forth to tell you the block number and line number where the error popped up. If you fancy things up it can even open that block up and put the cursor on the word that it last ran. 2023-05-05 15:54:41 It's harder when executing a compiled word. *Normally* there is no information maintained at that level - it would have a large performance impact. So usually this kind of debugging information only gets you to the last t hing *interpreted*, and where you are in the code that's triggered by that is something you then have to chase down by replicating the event and using debug prints or something to home in 2023-05-05 15:54:43 on the problem. 2023-05-05 15:55:52 I have last word and last atom executed and the error() function does tell its values 2023-05-05 15:56:08 also the error function when called can count lines until the source pointer to tell a line 2023-05-05 15:56:27 but usually that line has nothing to do with the place of the bug 2023-05-05 15:56:54 I also now have a "inside" error log, which tells if i'm inside colon words 2023-05-05 15:57:26 : oh ah ; : ah meh ; : meh error ; 2023-05-05 15:57:34 inside [ 'oh', 'ah', 'meh' ] 2023-05-05 15:58:23 but it's not too much 2023-05-05 15:58:38 I agree - the bug is usually down in the call tree of the interpreted word. 2023-05-05 15:58:57 You can't "wire in" tracing to that level without destroying your performance. 2023-05-05 15:59:14 yeah, that's why thinking in performance limits you a lot 2023-05-05 15:59:19 But you might be able to capture the call stack at the time of the error, and then studying that might tell you a lot. 2023-05-05 15:59:50 But a related problem is that where the bug causes a failure is often not related to what sowed the seed of that failure. 2023-05-05 15:59:54 I yet have to find the day I really need performance 2023-05-05 16:00:01 You have to develop an "understanding" of the whole failure mechanism. 2023-05-05 16:00:29 The Forth model offers a certain amount of performance, and I can't bring myself to willingly give it up. 2023-05-05 16:00:50 but for example thinking in performance, even without noticing, is why my words don't have checks 2023-05-05 16:01:00 The call stack analysis would be hugely informative, at least in terms of telling you the location of failure. 2023-05-05 16:01:22 it's why assume a word that expects a type of value, will receive that type of value 2023-05-05 16:01:32 Most Forths don't trap "runtime" errors, though - most of Forth's error handling stuff is around compile errors. 2023-05-05 16:01:56 I've written signal handling into mine to capture RAM address errors, divide by 0, and things like that. 2023-05-05 16:02:02 I try to say I don't want to care about performance, but I do without noticing 2023-05-05 16:02:05 bitmap(1) had a bug where a bad value got set on the config parse branch that only blew up very far away on another branch 2023-05-05 16:02:06 But only the things that naturally throw signals. 2023-05-05 16:02:32 thrig: Yes, and there's really no way for a system to aim you right at those problems. 2023-05-05 16:02:44 The system doesn't understand your code in that way. 2023-05-05 16:03:07 I suppose simplicity also comes in to play 2023-05-05 16:03:27 I can't see together extensive testing and simplicity 2023-05-05 16:03:29 When I have that kind of problem, the only thing for it is to roll up my sleeves. 2023-05-05 16:03:34 It's time consuming sometimes. 2023-05-05 16:04:06 but reflection is good in a language, and "metadata" helps debugging 2023-05-05 16:04:56 say you can mantain the number of elements every word takes from the stack 2023-05-05 16:06:50 KipIngram: you use signals as error system? 2023-05-05 16:07:22 like they're fired events 2023-05-05 16:07:55 Yeah. Those signals already exist in the Linux underpinnings. Normally a RAM address error will throw a segfault and return you to the bash prompt. 2023-05-05 16:08:02 Unless your code catches it and handles it. 2023-05-05 16:08:35 it's cool how you change a segfault for error handlers 2023-05-05 16:08:38 xD 2023-05-05 16:08:41 I did that - I wrote in a signal handler that routes me through my already existing error recovery system, which essentially restores the system to the state it had before I started typing the last line and sends me back to the interpreter. 2023-05-05 16:09:15 I already had a fairly typical error handler (except for the "restore" thing - usually Forth will just clear the data stack and go to the interpreter). 2023-05-05 16:09:26 But originally it only got tickled by compiler errors. 2023-05-05 16:09:44 Catching those signals wasn't easy, and there is NOT good documentation on how to do it out there. 2023-05-05 16:09:58 Because it necessarily involves processor architecture dependent details. 2023-05-05 16:10:04 It wouldn't be "portable." 2023-05-05 16:10:14 so every line you read you save the current state 2023-05-05 16:10:16 The idea would be, but details would have to be changed. 2023-05-05 16:10:27 no matter is from a block or stdin 2023-05-05 16:10:40 Everytime the interpreter prompts me to type a line, I make a full snapshot of my system and save it. 2023-05-05 16:10:44 Horribly expensive. 2023-05-05 16:10:55 then part of the error handling is to restore from that snapshot. 2023-05-05 16:11:06 If no error occurs, the snapshot is just abandoned. 2023-05-05 16:11:16 And overwritten by the next one. 2023-05-05 16:12:00 Linux just has the hardware set up so that those errors cause traps. 2023-05-05 16:12:12 It handles the traps in a certain way - I'm just specifying a different handling. 2023-05-05 16:12:14 horribly expensive, but not much memory at all 2023-05-05 16:12:21 Not really, no. 2023-05-05 16:12:34 On a regular computer with as much RAM as we have, I figured "why not." 2023-05-05 16:12:43 You see, the first system I did this on had command line history. 2023-05-05 16:13:13 What I was aiming at was to type a line with an error, and when the error occurred I wanted to just hit up-arrow to recover that line, cursor around in it and fix the error, and hit Enter again. 2023-05-05 16:13:19 I'd like to have a proper error system 2023-05-05 16:13:27 So I wanted the system state to be what it was when that line started to be processed. 2023-05-05 16:13:39 I have to learn about first 2023-05-05 16:13:50 I worked my way up to this - at first I had a pretty simple error handler. 2023-05-05 16:13:59 But then I started to run into situations it didn't handle well. 2023-05-05 16:14:25 Esepcially when lines made changes to vocabularies. Or what if the line defines a word, successfully, before the error? 2023-05-05 16:14:52 I kept finding one thing after another I needed to struggle to "unwind," and finally I just said "Screw it" and decided to save and restore EVERYTHING. 2023-05-05 16:14:57 A literal image of the entire system. 2023-05-05 16:15:38 So it restores the dictionary, the stacks, the CONTEXT and CURRENT vocabularies, and so on. All of it. 2023-05-05 16:15:47 Sledge hammer. 2023-05-05 16:15:59 in a vm is also easy to have snapshots 2023-05-05 16:16:37 a bytecode interpreter ends providing a lot of benefits 2023-05-05 16:16:48 and it's just a switch case with another nam 2023-05-05 16:16:50 name* 2023-05-05 16:17:04 Sure. And doesn't HAVE to be inefficient, if you're careful with your code. 2023-05-05 16:17:31 I think the next Forth I write may wind up being a "token threaded" system more than anything else. Except I'm thinking of 16-bit tokens instead of byte tokens. 2023-05-05 16:17:36 I suppose a vm is my next logical step 2023-05-05 16:18:02 crc has shown me several times how much portability adds 2023-05-05 16:18:03 Well, Forth systems actually ARE vms. In a very literal way, it's a vm and the primitives are the instructions. 2023-05-05 16:19:06 You breach that barrier a bit if you have an assembler. But as long as you're writing "just Forth," you're working no lower than with those primitive instructions. 2023-05-05 16:19:46 Forth just offers you the "elegance" of being able to define new words that "work" exactly like the primitives do. 2023-05-05 16:20:01 what will you store on those 16 bit 2023-05-05 16:20:04 You don't need a special format for invoking your added functions, the way you do in most other languages. 2023-05-05 16:20:26 An index into a table of code and parameter pointers. 2023-05-05 16:20:44 The same pointers that Forth would normally use, only collected into a pair of tables. 2023-05-05 16:21:02 Those tables are why I say it's more of a token threaded system. 2023-05-05 16:21:21 In my current and past systems, those pointers have been spread out in the headers of words. 2023-05-05 16:22:09 I haven't started this yet - I may change my mind. 2023-05-05 16:22:23 It just currently appeals to me, because having 16-bit xt's makes for such a compact system. 2023-05-05 16:23:13 For fastest performance, though, those tables will need to have 64-bit entries, and that makes me wince. 2023-05-05 16:23:33 That's 16 bytes per word, right there, before I've actually provided ANY actual implementation of the word. 2023-05-05 16:23:57 I could make those table entries 32 bits instead, but then I'd have to run a little slower; the mechanics of the vm would be made more complex. 2023-05-05 16:24:21 But I could just have one table then instead of two, with each "entry" being a CFA / PFA pair. 2023-05-05 16:24:28 Lot of small decisions to make around it. 2023-05-05 16:24:57 And these tables are two more things that have to be somewhere in RAM and have to have room to grow, so it fragments up my memory model more than other approaches. 2023-05-05 16:26:00 So we're talking about at least three regions, and maybe four - depending on one table vs. two. 2023-05-05 16:26:22 An implementation region, where code and definition lists go, the one or two table regions, and the header region. 2023-05-05 16:28:30 Another annoying aspect of it involves wasted space on primitives. Primitives don't need a parameter pointer. For built-in primitives I can avoid any waste, but if I add a primitive later, with an assembler, it will have to have a slot in both tables, in spite of not needing a slot in the parameter table. 2023-05-05 16:28:53 Otherwise the table locations for a given word would get out of sync. 2023-05-05 16:29:09 A word's index has to point to the right thing in both tables. 2023-05-05 16:31:10 But if I accept that and also accept the eight-byte table entries, then the "inner interpreter" (next) is only two instructions, and next, docol, and the multi-thread switching machinery all together are only nine. 2023-05-05 16:31:13 It's beautiful. 2023-05-05 16:32:11 Oh, it also calls for registers dedicated to pointing to each of the two tables. 2023-05-05 16:33:27 But in my old systems I use a register to point to the header region, and in this new system I'm talking about that could be demoted to a variable. 2023-05-05 16:33:43 Since anything having to do with headers isn't relevant to run-time performance. 2023-05-05 16:36:09 I'm trying to convince myself about making a switch case 2023-05-05 16:36:23 https://jilp.org/vol5/v5paper12.pdf 2023-05-05 16:36:34 What's "easy" in Forth is an indexed jump table. 2023-05-05 16:36:37 The Structure and Performance of Efficient Interpreters 2023-05-05 16:36:55 I.e., a "switch" with integer cases, 0, 1, 2, 3, ... 2023-05-05 16:36:56 yeah, a hash with functions as values also works 2023-05-05 16:37:07 Having arbitrary case trigger values is a lot more tedious. 2023-05-05 16:37:10 but a switch is usually faster 2023-05-05 16:37:43 a hash with functions is better than a switch 2023-05-05 16:37:45 I think if I were going to do that, I'd supply a mechanism to map arbitrary case identifiers onto integers. 2023-05-05 16:37:53 And call that first and then use a jump table. 2023-05-05 16:38:51 It would still be harder. 2023-05-05 16:47:32 I'm curious about using a forth-like to write assembly code 2023-05-05 16:47:54 you can add layer to layer until having something quite advanced 2023-05-05 16:48:31 but it's strange to see you don't usually do that 2023-05-05 18:14:51 Well, that's exactly how Forth is intended to be used, though. 2023-05-05 19:52:20 Lot of Forth I see in other places just looks like C. At least it's laid out on the page like C. 2023-05-05 20:22:46 maybe that's C coders trying to make it look more Cish 2023-05-05 21:30:01 Yeah, my presumption too. 2023-05-05 21:30:51 I fully admit to making C-like Forth - I've learned to love the local variable 2023-05-05 21:31:52 (seriously, just try to write code that blits from one rectangle on one bitmap to another rectangle on another bitmap without them) 2023-05-05 21:32:09 (which is precisely why I gave in and added them to my Forth) 2023-05-05 21:32:58 a RNG was a bit tricky without local variables, there were like five little fiddly state variables 2023-05-05 21:35:02 the thing is that my local variable-using code is simpler (and probably much faster) than what its traditional counterpart would be 2023-05-05 21:35:07 far less ROT, no ROLL 2023-05-05 21:35:13 ROT and -ROT are expensive 2023-05-05 21:35:20 I've run into Forth cases where I needed more that the two two items on the stack. We talked about that at length here one day. It's what prompted me to add stack frames to my Forth. They're basically local variables - just unnamed. 2023-05-05 21:35:20 setting a local variable is not 2023-05-05 21:35:57 Yeah, there's nothing "expensive" about indexing into the stack. It's just not well thought of. 2023-05-05 21:36:17 my local variables live on the return stack, and I've made DO LOOP's use local variables behind the scenes so they're compatible with local variables 2023-05-05 21:36:22 Especially if you set up a mechanism to make it efficient. 2023-05-05 21:36:24 also, my local variables are block-scoped 2023-05-05 21:36:32 KipIngram, PICK is very cheap 2023-05-05 21:36:41 ROT, -ROT, and especially ROLL are not 2023-05-05 21:36:44 Yeah. 2023-05-05 21:37:13 I work on the data stack, because it's not so much "locals" I want as access to parameters and intermediate results. 2023-05-05 21:37:24 I don't use the mechanism very much. 2023-05-05 21:37:24 my code prior to my learning to love the local variable was chock full of ROT and -ROT 2023-05-05 21:37:32 I look for ways to avoid it. 2023-05-05 21:38:19 to me local variables make it easier to make more reliable code faster because I then don't have to constantly keep mental state of the state of the stack all the time 2023-05-05 21:38:33 or otherwise write detailed stack annotations on each line, and hope I got them right 2023-05-05 21:39:44 for my pre-local variable code I now go back to it and often don't understand a thing 2023-05-05 21:44:55 I understand and actually support the general "no locals" philosophy. In most cases, if you need that much data around you haven't factored enough. Now and then, though, I bumped into cases I couldn't figure out how to handle by further factoring. 2023-05-05 21:45:08 So I pull that tool out just for those cases. 2023-05-05 21:46:07 to me the issue is when you simply cannot remove state 2023-05-05 21:46:23 Yeah - some things just have complex state. That's exactly it. 2023-05-05 21:46:29 e.g. when you have to work with two strings, both with a pointer and a count 2023-05-05 21:46:49 And when you need to get at a lot of it, and not just pieces of it at a time, it's hard with normal Forth words. 2023-05-05 21:46:57 saying "oh you have to limit yourself to two things on the top of the stack" doesn't cut it 2023-05-05 21:47:13 Well, I find that it's often possible to do that though. 2023-05-05 21:47:22 And it usually does strike me as cleaner code. 2023-05-05 21:47:31 But not "always." 2023-05-05 21:47:42 to me stack churn is a code smell 2023-05-05 21:48:03 and a lot of time stack churn is unavoidable unless you use local variables 2023-05-05 21:48:49 pre-local variables I'd use >R R@ R> a lot to simplify my data stack usage, but local variables do the same thing while being far more readable and far less error-prone 2023-05-05 21:49:10 Sometimes. You can avoid it in many cases. 2023-05-05 21:49:35 You've got to think ahead so things are arranged the right way on the stack. 2023-05-05 21:50:38 I don't think there's anything wrong with having a way to reach into the stack. It's nice when you don't have to, but as we noted earlier, it's not inefficient. 2023-05-05 21:51:03 my usual pattern would be to identify the single most important thing in a word (what is called "this" or "self" in OO languages), and I'd stick it on the return stack 2023-05-05 21:52:37 the problem with PICK is the mental gymnastics of having to identify how deep to reach into the stack each time you use it 2023-05-05 21:52:45 it's error-prone 2023-05-05 21:53:06 Yes it is. That's what my stack frames avoid. 2023-05-05 21:53:15 and to make it work you have to stick an ( x y z foo bar baz etc etc etc ) at the end of each line of your code to keep track of it all 2023-05-05 21:53:17 I do a stack frame with { ... } 2023-05-05 21:53:30 The { sets a "frame pointer," and then inside the frame I index off of it. 2023-05-05 21:53:39 The top of the stack can move around, but the frame pointer stays put. 2023-05-05 21:53:45 So the offset of things remains unchanged. 2023-05-05 21:54:08 I use { ... } for defining local variables 2023-05-05 21:54:13 { sets the frame pointer to the stack pointer, and } sets the stack pointer to the frame pointer. 2023-05-05 21:54:20 Existing frame pointer is saved on the return stack. 2023-05-05 21:54:54 note, however, that I can define local variables multiple times in a word, and I can access them from within DO LOOP's 2023-05-05 21:55:05 traditional, standard local variables can't do that 2023-05-05 21:55:33 That restoring the stack pointer at the end is a nice fringe benefit. I make control structures using conditional single and double returns, so I can "return back up" into a stack frame from multiple places sometimes, and those routes might leave different amount of stuff on the stack. 2023-05-05 21:55:40 in Standard forth you can define local variables once in a word, outside of any blocks, and you can't access them within DO LOOP's 2023-05-05 21:55:43 I don't have to worry about that because } will clean things up. 2023-05-05 21:56:39 ACTION has been following gforth as a model for his local variables 2023-05-05 21:56:55 I actually give } a parameter - it's a number of "additional" items to drop from the stack. Nice way to get rid of parameters no longer needed. 2023-05-05 21:57:57 If I wanted "locals," I'd probably just move the stack pointer further along, allocating space below the frame pointer, and index off of it in the negative direction. 2023-05-05 21:58:36 if I were you I'd make } take its number of extra items to drop at compile time 2023-05-05 21:59:01 reason being is then you can just compile it into the code as a simple addition, in many cases as a single instruction 2023-05-05 21:59:52 a big advantage of how I've implemented local variables is that dropping them is simply ADD SP, SP, # 2023-05-05 22:00:02 and this is all automated for you 2023-05-05 22:00:33 Is your Forth code-threaded? 2023-05-05 22:00:47 my Forth is an inlining native code Forth 2023-05-05 22:01:08 Ok, sure then. My Forth is indirect threaded, and } is a primitive - that's as "compiled" as it gets in my system. 2023-05-05 22:01:30 I suppose I could create 0} and 1} and 2} and so on if I wanted to, but I haven't. 2023-05-05 22:01:54 I write fairly primitive-heavy Forths already. 2023-05-05 22:02:20 I personally criticize the design of standard forth +LOOP because it's a pain to optimize because it takes its argument at runtime 2023-05-05 22:02:27 I do just that kind of thing on the stack *access* words. I have 1@ and 1! and 1+! and 2@ and ... 2023-05-05 22:02:36 You get the idea. On up to 5 or 6. 2023-05-05 22:02:48 yeah 2023-05-05 22:03:02 car cdr caar cadr cdar cddr caaar 2023-05-05 22:03:07 yeah 2023-05-05 22:03:51 ... cddaar cddadr cdddar cddddr 2023-05-05 22:03:55 actually 2023-05-05 22:04:19 if you're really smart about it, you can optimize much of that stuff even without explicitly specifying it at compile time 2023-05-05 22:04:27 My reasoning was that I use the stack access words a fair bit, whereas { and } themselves are used less often. 2023-05-05 22:04:43 what I do is I "defer" literals and constants 2023-05-05 22:04:52 I don't immediately compile them into instructions 2023-05-05 22:05:01 the other nice thing about my mechanism is that I can call from inside { ... } and no matter how deep down I go I can still access the frame with the same indices. 2023-05-05 22:05:10 Unless I open another frame down there. 2023-05-05 22:05:16 and then if I have a word like +, it detects whether there's a deferred literal or constant 2023-05-05 22:05:28 and if there is, it folds it into the compiled instruction 2023-05-05 22:05:44 for instance 1 + compiles to a single instruction, ADDS R6, #1 2023-05-05 22:05:46 Yeah, with a system with a lot of inlining there are all kinds of fun games you can play. 2023-05-05 22:06:45 I just like indirect threading, and I always figure that if I need peak performance I can custom assemble those bits. It's usually only a very small part of your code that makes any big difference. 2023-05-05 22:07:12 And I want a good profiling mechanism. I haven't written one yet, but I know how I want to write it. 2023-05-05 22:07:25 you could do something like this - make words like s! s@ s+! and have a deferred literal/constant mechanism 2023-05-05 22:07:31 Especially with this table-based scheme I'm considering it will be quite easy. 2023-05-05 22:07:47 and when you compile s! s@ or s+! have it check for a deferred literal/constant 2023-05-05 22:08:17 and if it is within a certain range, it generates a hardcoded word, such as 2 s+! could compile to 2+! 2023-05-05 22:08:18 My interests at the moment are just pointing in other directions. 2023-05-05 22:08:32 This threading and piping stuff is on my mind. 2023-05-05 22:10:51 I'm into native code compiling because I want to squeeze out the performance of the systems I target, and the systems I target are large enough that I don't have to worry that much about code size (they're certainly not PC's or even the SoC RPi's though) 2023-05-05 22:12:36 still, my compiler doesn't rival Matthias Koch's Mecrisp-Stellaris - Matthias is a veritable compilers wizard 2023-05-05 22:13:14 I'm a big fan of performance. I just find indirect threading... "endearing." :-) Like I said, I want to profile and optimize where it matters. 2023-05-05 22:16:12 I'm in the habit of writing a lot of primitives in Forth that generate native code directly 2023-05-05 22:17:03 e.g. my local variable code is in Forth, but it generates native instructions