2024-03-23 00:15:24 messing around with swiftforth past few days for nothing more than giggles and stuff. I like that it works on osx 10.4 and above (at least until catalina) 2024-03-23 10:12:39 Al2O3: SwiftForth <3 2024-03-23 10:12:50 I absolutely love it, Forth Inc are great 2024-03-23 10:13:19 I would Rather use it than any other commercial offerring 2024-03-23 10:17:04 I realise that one of the reasons I struggled with maths in a uni setting was that a lot of marks were for presenting not a correct proof, but a tidy proof. I'm not tidy at all, and to write proofs tidy you basically need to memorise it by heart. 2024-03-23 10:17:29 I don't memorise anything by heart really, I just remember the logic or key points as well as I can and try to rederive it 2024-03-23 10:17:44 And you get less marks for that approach, even though it's more helpful in long run 2024-03-23 10:18:21 Because the PhD student who marks it doesn't like the messy scribbling and crossed-out work 2024-03-23 10:18:53 But I just absolutely suck at memorising stuff by heart, I'm quite deficient at that 2024-03-23 10:20:07 With computing the problem is quite similar, but I'm *so* interested in computing that it sort of makes up for it 2024-03-23 12:40:23 in my experience, the types who "understand" are lightyears ahead of the "memorize" types when it comes to applying knowledge 2024-03-23 12:41:41 screw the academics. they still think the world is going to burn up or freeze over in 3 years or that boys can become girls by dressing differently 2024-03-23 13:32:39 I think the people who memorise also usually understand (or they don't get through the unseen proof questions), but I just suck at that memorisation bit. 2024-03-23 13:33:37 You can take anything I say about academia with a pinch of salt because frankly it never suited me as a person anyway 2024-03-23 13:34:25 I'm no good in a uni setting, I need to be out there 'doing something' 2024-03-23 13:43:31 zelgomer: obligatory https://www.jpl.nasa.gov/news/emission-reductions-from-pandemic-had-unexpected-effects-on-atmosphere 2024-03-23 14:08:45 the government lied about every aspect of the pandemic, and you think i'm going to waste one minute of my saturday morning reading their lies about climate change? the fact is we're still here and we're just fine after several generations of "doomsday within the next 10 years" predictions 2024-03-23 14:20:06 You're missing out then lol, the article adds to your point 2024-03-23 14:20:34 oh, well 2024-03-23 14:21:46 i'm on mobile atm and couldn't see the full url 2024-03-23 14:28:19 goal for today is to get this mess of spaghetti that's supposed to be the target : -; ; etc. to work 2024-03-23 14:29:00 this is where i usually get lost in chicken/egg logic 2024-03-23 14:30:58 but this time i at least have a new tool to help with the tripping over my own feet problem 2024-03-23 14:32:28 which is a cmforth style { } word. as far as i can tell, it doesn't work exactly like his did, but imo it integrates better with vocabularies and for doing what i'm doing 2024-03-23 19:00:40 Question 2024-03-23 19:00:54 A forth game 2024-03-23 19:00:58 How would you manage state? 2024-03-23 19:01:17 I guess dictionary is your state? 2024-03-23 19:01:44 Not a bad strategy imo 2024-03-23 19:01:59 And yeah sorry for not getting back sooner, this week was fucking crazy 2024-03-23 19:02:58 lf94: what other programming language are you comfortable with? 2024-03-23 19:03:23 Rust, JavaScript/TypeScript 2024-03-23 19:03:27 C is ok 2024-03-23 19:03:45 how would you manage your state in rust? 2024-03-23 19:03:53 State struct 2024-03-23 19:04:23 There are a few ways to manage state in a game 2024-03-23 19:04:34 But the go-to is a large State structure 2024-03-23 19:05:33 there you go 2024-03-23 19:06:01 Yeah but how do you express this in Forth and store it 2024-03-23 19:06:05 and access it 2024-03-23 19:06:07 and modify it 2024-03-23 19:06:14 What kind of game? 2024-03-23 19:06:21 create, variable, constant, @, ! 2024-03-23 19:06:31 just a bunch of variable right 2024-03-23 19:06:43 using dictionary as a giant structure basically 2024-03-23 19:06:54 this is what you're doing in rust 2024-03-23 19:07:05 it just looks different 2024-03-23 19:07:18 right, just stating the forth working context here 2024-03-23 19:07:23 lf94: You can define any kind of structure you want in Forth, but you have to do all the address calculations yourself. I.e., know how big eacch field is, skip over the stuff you need to skip over to get to what you're interested in, etc. 2024-03-23 19:07:23 cool cool 2024-03-23 19:07:36 yep that's perfectly ok Kip 2024-03-23 19:07:40 You can use Forth's features like create/does> to "package" some of that work. 2024-03-23 19:07:57 I havent touched does> yet but I'll look :) 2024-03-23 19:08:04 obviously you can write words to automate it 2024-03-23 19:08:20 Could someone share a very small snippet of what this looks like in forth 2024-03-23 19:08:36 or you can not do offset calculations and just use variables. encapsulate them in a vocabulary to not pollute your namespace 2024-03-23 19:09:49 That's what I was thinking to prefer. 2024-03-23 19:10:14 lf94: conventional forth uses words like >name >body >lfa >cfa etc. to work with word headers, and it's an example of what KipIngram is talking about 2024-03-23 19:11:04 "to work with word headers" 2024-03-23 19:11:10 those are word...addresses right 2024-03-23 19:12:14 no 2024-03-23 19:12:23 they're data structures 2024-03-23 19:13:59 well I know a header is basically metadata 2024-03-23 19:14:19 but in this case we're jumping from the header address to a data address no? 2024-03-23 19:16:34 It depends on what kind of Forth architecture you're using. Somehow the header will point to the stuff you can actually "execute." In a subroutine threaded system that would just mean "pointing to code." In other kinds of systems it's pointing to a list of addresses, which themselves either point directly to code or a pointer that points to code (those two are "direct" and "indirect" threading). 2024-03-23 19:17:00 In all three cases, though, that's the stuff that the system can actually "execute," and the header tells you where to find it. 2024-03-23 19:17:55 right right 2024-03-23 19:17:57 anyway 2024-03-23 19:18:11 im having a weird error 2024-03-23 19:18:42 Any kind of useful error message? 2024-03-23 19:19:35 https://gist.github.com/lf94/a7af20e8ca76c0ea5390d711fc8223d2 2024-03-23 19:19:37 yea 2024-03-23 19:19:44 k10, k11, k12 redefined 2024-03-23 19:19:49 I delete them - works 2024-03-23 19:19:59 why? 2024-03-23 19:20:59 Looks like gforth uses k12 as a constant, something to do with function keys 2024-03-23 19:21:08 that is fricking....aaaaaaaaaaaaa 2024-03-23 19:21:10 frustrating 2024-03-23 19:21:38 You can still use those names, it just means you can't access gforth's original definirtions 2024-03-23 19:21:48 it says eb is an error too 2024-03-23 19:22:03 $ gforth sha256.f -e bye 2024-03-23 19:22:05 redefined k10 redefined k11 redefined k12 2024-03-23 19:22:07 in file included from *OS command line*:-1 2024-03-23 19:22:09 sha256.f:75: Stack underflow 2024-03-23 19:22:11 create k61 a4 c, 50 c, 6c c, >>>eb<<< c, 2024-03-23 19:22:13 Backtrace: 2024-03-23 19:22:15 $7FD7B7C51D30 dup 2024-03-23 19:22:17 $7FD7B7C50900 2024-03-23 19:22:19 $7FD7B7C51E18 Ext 2024-03-23 19:22:22 redefined is not an error, it's just letting you know 2024-03-23 19:22:34 sorry sorry, yea, didn't mean "too" 2024-03-23 19:23:51 eb also seems to be an existing definition 2024-03-23 19:23:57 ooof 2024-03-23 19:24:04 so "hex eb" is not possible? 2024-03-23 19:24:20 i thought this was standard 2024-03-23 19:24:32 how do I tell gforth to not include its garbage 2024-03-23 19:24:45 That does seem weird 2024-03-23 19:25:43 it completely breaks hex 2024-03-23 19:27:17 hex 0eb 2024-03-23 19:28:06 I should 0 prefix fricking everything? 2024-03-23 19:28:15 you should probably just not use gforth 2024-03-23 19:28:48 but gforth is eternal 2024-03-23 19:28:50 :V 2024-03-23 19:28:52 what should I use 2024-03-23 19:28:55 pforth? 2024-03-23 19:29:05 i don't know. i've never used a forth before that i didn't write. 2024-03-23 19:29:17 ill $ prefix. 2024-03-23 19:30:07 but i would search for something that keeps it small and simple and doesn't add a bunch of bullshit 2024-03-23 19:30:27 I think there's value in using gforth 2024-03-23 19:30:36 the value is, there are a handful of human beings maintaning it 2024-03-23 19:30:43 but above all 2024-03-23 19:30:49 I want to write forth that works on all forths 2024-03-23 19:30:57 impossible 2024-03-23 19:32:45 ok 2024-03-23 19:32:47 "almost works" 2024-03-23 19:33:02 minor source changes 2024-03-23 19:33:17 seriously, that does not need to be a goal right now. or probably ever. focus on learning the language. 2024-03-23 19:33:36 it helps me learn a subset of the language 2024-03-23 19:33:52 when you have a better understanding of the language and of different implementations, then you will see the futility in this 2024-03-23 19:38:33 They must already be words in your dictionary? k10-k12? 2024-03-23 19:40:55 Some Forths will warn you when you redefine words but will still redefine them. 2024-03-23 19:41:16 It won't affect any compiled definitions - they'll continue to use the instance that was in play at the time of compilation. 2024-03-23 19:42:22 That page you linked to sure doesn't look much like Forth to me. 2024-03-23 19:42:40 Some of it does - all the creates for example. 2024-03-23 19:42:58 but "a := h0" doesn't. 2024-03-23 19:43:17 Was it Pascal that used that assignment operator? 2024-03-23 19:43:55 It's probably been... 35 years since I've done any Pascal. 2024-03-23 19:43:55 those are comments 2024-03-23 19:44:03 Oh, duh. 2024-03-23 19:44:06 Thanks. :-) 2024-03-23 19:44:49 Sure enough - right there in front of me. I feel so clever today... 2024-03-23 19:46:39 Better late than never :P 2024-03-23 19:55:36 KipIngram Redefines:  with interpreted Forth does redefines change older defs or is it implementation dependant? 2024-03-23 19:58:19 When you redefine a word, it only affects definitions after that, usually 2024-03-23 20:19:03 using $ fixes it all btw 2024-03-23 20:19:09 do most forths accept $ ? 2024-03-23 20:19:23 no 2024-03-23 20:20:05 damn. 2024-03-23 20:24:47 lf94: you will never see most forths the same as you will never hear most regional dialects 2024-03-23 20:25:08 oh 2024-03-23 20:25:12 that's actually good to know 2024-03-23 20:25:14 thank you :) 2024-03-23 20:26:49 that is to say, there is a forth "standard," but most forth users don't adhere to it, or even like it very much 2024-03-23 20:27:08 so for practical purposes, you're targetting a language that is not standardized 2024-03-23 20:31:54 lf94: for an extreme example, i encourage you to go look at crc's retro and compare it to gforth. 2024-03-23 20:33:39 heck even https://github.com/howerj/embed differs from gforth 2024-03-23 20:34:30 "When you've seen one Forth, you have seen one Forth." - Wil Baden 2024-03-23 20:39:07 lf94: you could try to aim for strict ANS compatibility in the words you use; that'd let things (mostly) work on gforth, vfx, swiftforth, and probably others. 2024-03-23 20:39:37 But certainly not all, and changes will likely be required even for systems targeting ANS compliance 2024-03-23 20:40:39 I heard everyone hates ans forth 2024-03-23 20:40:56 skvery: for redefinition, most systems I've seen it only affects future use. I've only encountered a few that altered the prior definition. 2024-03-23 20:40:57 that's all good though 2024-03-23 20:41:09 seriously knowing that all forths are essentially different is good to internalize. 2024-03-23 20:42:00 ah cool. ." is special. 2024-03-23 20:42:15 I thought `." hello "` would put something on the parameter stack 2024-03-23 20:42:38 I'd not say that everyone hates it. The commercial vendors seem fine with it, gforth aims to support it. But there's a much larger number of systems that only partially support it or (like mine) completely ignore it 2024-03-23 20:43:02 lf94: it's not just a distaste for ans, but i think for a lot of people (for me, anyway), it's that there's no need for it. if i wanted to target a standardized language and write portable code, then i would write c. the reason (imo) to use forth is because it's so easy to write your own, and then you have full control and freedom to experiment with new ideas on a whole new level. 2024-03-23 20:43:38 How do I see what's defined in dictionary? 2024-03-23 20:43:45 usually "words" 2024-03-23 20:43:46 Trying to learn-by-using here 2024-03-23 20:43:59 where is ." hello " being stored? will words show that? 2024-03-23 20:44:10 where did you use it? 2024-03-23 20:44:36 on the repl 2024-03-23 20:44:53 "outer interpreter" i guess? 2024-03-23 20:45:09 i don't know how gforth works, but i expect it was probably written to some unreserved area of the dictionary 2024-03-23 20:45:22 It won't be stored, just executed 2024-03-23 20:45:26 yeah 2024-03-23 20:45:35 oh cool, ok 2024-03-23 20:45:57 Im trying to figure out how to append some bytes to "hello"... 2024-03-23 20:47:15 you do it by reserving enough memory for both strings and then writing them both to the new memory 2024-03-23 20:47:37 oh nice, ok 2024-03-23 20:51:17 gforth has an append word: s" hello" s" , world!" append 2024-03-23 20:56:12 might be interesting to use "see append" 2024-03-23 20:56:25 assuming gforth has a working see 2024-03-23 20:57:04 oh nice 2024-03-23 21:19:41 hm, kinda stuck 2024-03-23 21:20:14 i would expect create hello ." hello " to place (size, str) at "hello" address 2024-03-23 21:20:25 not sure what to think 2024-03-23 21:21:11 i think you want s" 2024-03-23 21:21:52 and even then s" only puts the address and length on the stack, he needs to actually write it 2024-03-23 21:22:17 i don't know the common word for this. is it s, ? i usually call mine ", 2024-03-23 21:23:09 ah yes, good point 2024-03-23 21:23:18 in gforth at least it is indeed s, 2024-03-23 21:23:31 oh nice, ok 2024-03-23 21:23:46 what circumstance do we use ." thing " ? 2024-03-23 21:24:34 ." is for displaying a string 2024-03-23 21:24:56 (where the string is parsed, following the ." until the closing ") 2024-03-23 21:30:41 lf94: Can disable warnings in gforth with the warning variable 2024-03-23 21:30:51 warnings* 2024-03-23 21:30:53 e.g. 'warnings off' 2024-03-23 21:38:12 If you want to use EB as a hex constant maybe write 0EB 2024-03-23 21:38:33 But it's a bit shit that gforth has EB defined in its default dictionary 2024-03-23 21:39:00 what does it do, even? 2024-03-23 21:40:46 : Eb 139729034275752 Ext ; 2024-03-23 21:40:48 No clue 2024-03-23 21:42:00 nice 2024-03-23 21:43:06 It's in ONLY FORTH which is just fantastic 2024-03-23 21:43:40 For some reason ONLY FORTH has two wordlists 2024-03-23 21:44:12 remember when i said i also have ideas i think nobody would want? :) 2024-03-23 21:44:30 Yeah I do actually 2024-03-23 21:46:11 i may still play with this at some point, but i suspect it's just confusing and of not much utility. but the short version is for "forth" to be a special vocabulary that actually searches the load parent's context stack 2024-03-23 21:46:39 so each time you nest a load, you inherit a new "forth" which is the sum of the entire context stack at the time load was invoked 2024-03-23 21:49:32 Reminds me of environments in Lua 2024-03-23 21:49:36 And probably other scripting languages 2024-03-23 21:49:39 If I understand right 2024-03-23 21:49:56 yes you do, and i actually caught myself using some lua terms to describe it and edited them out LOL 2024-03-23 21:51:25 it's sort of analogous to lua's package server function 2024-03-23 21:51:45 is how i think i'd implement it, anyway. in use, it's more like environments, yes 2024-03-23 21:52:57 Have you seen forth inc packages? 2024-03-23 21:53:18 no. i saw your code use package foo ... public ... 2024-03-23 21:53:44 It's entirely stolen from forth inc's packages 2024-03-23 21:55:00 i've been doing something similar but very manually. first line "vocabulary foo also foo definitions vocabulary private private definitions" and then later "also foo definitions" and at the end, "scrub private". my load then restores the context stack and definitions pointer when load returns. probably should consider wrapping that stuff into nice words 2024-03-23 22:01:09 I think this is untested but something like this probably works https://pastebin.com/raw/F5zn004G 2024-03-23 22:02:05 Actually fixed comment https://pastebin.com/raw/bpLHEVbZ 2024-03-23 22:03:59 I like how it keeps 'private' words in another wordlist so they don't impact search speed 2024-03-23 22:05:58 Another implementation here https://theforth.net/package/package/current-view/package.fs 2024-03-23 22:06:11 A forth package package 2024-03-23 22:06:41 The 'eb' word in gforth-0.7.3 is part of the disassembler: https://pastebin.com/m8trEX9V 2024-03-23 22:07:19 Thanks 2024-03-23 22:08:06 gross 2024-03-23 22:08:28 I don't see it in a copy of the 0.7.9 source tree, so I'm assuming they renamed it 2024-03-23 22:08:49 Nothing wrong with having words like that but honestly there shouldn't be a lot of really short words in forth-wordlist 2024-03-23 22:08:57 From things like the disassembler 2024-03-23 22:09:13 Maybe they tidied up in later revisions 2024-03-23 22:09:23 dev can make an alias to something longer if they're spamming it alot 2024-03-23 22:09:59 wordlists 2024-03-23 22:10:06 just saw this zelgomer> it's sort of analogous to lua's package server function s/server/searcher/ 2024-03-23 22:12:10 I'm just thinking if you want short words put them in another wordlist 2024-03-23 22:12:20 Don't pollute forth-wordlist 2024-03-23 22:12:30 yeah 2024-03-23 22:12:41 If you're implementing a big standard forth 2024-03-23 22:12:50 Not writing programs, do whatever you want in an app