2024-07-20 15:18:12 so i've been trying to figure out how to make some kind of c-like abomination that borrows some properties from forth, one of which was typelessness. i couldn't figure out how a typeless c would work because the assignment and index operators depend on the typing to do the right thing. e.g., does "*x = 123" store a char or a cell? 2024-07-20 15:19:21 zelgomer: have you looked at BCPL? 2024-07-20 15:19:44 i started reading about b, and the way it works is that every variable is a word, and the dereference operator * just turns an rvalue into an lvalue. and then it hit me: maybe the way you write this is with different dereference operators. 2024-07-20 15:20:06 GeDaMo: no i didn't look at bcpl yet 2024-07-20 15:22:51 so i could imagine something like: *x = 123 /* store a word */ @x = 123 /* store a char */ not sure how indexing would look. maybe it's just always by byte, or maybe you have words[i] and chars[[i]] 2024-07-20 15:25:05 but then i imagine writing "c" this way and without structs and tbh that sounds not at all worth it to me. 2024-07-20 15:25:34 so much of c's power comes from struct imo 2024-07-20 17:47:02 How do I output terminal escape code 2024-07-20 17:47:10 I'm adding more colors to my turmites code 2024-07-20 17:47:48 https://en.wikipedia.org/wiki/ANSI_escape_code#CSI_(Control_Sequence_Introducer)_sequences 2024-07-20 17:48:49 In forth 2024-07-20 17:49:26 emit 2024-07-20 17:49:35 27 emit 91 emit 2024-07-20 17:49:43 For escape [ 2024-07-20 17:50:51 Or you can build strings and type them out 2024-07-20 17:53:00 ah perfect 2024-07-20 17:53:51 so my turmites code is fixed turns out wikipedia has an error on the turmite page 2024-07-20 17:54:03 it should be a 1-state, 2-color turmite to match langton's ant 2024-07-20 18:12:16 lf94: one thing to watch out for is that . will output a space at the end which will mess up ANSI codes 2024-07-20 18:13:32 Some systems have (.) on them and then : . (.) SPACE ; 2024-07-20 18:19:41 thanks 2024-07-20 18:20:12 after I extend my turmites to use 4 colors and 4 states, and output colors, i think ill start putting together my forth demo video 2024-07-20 18:22:04 do you guys have any suggestions on inclusions in the video? :) 2024-07-20 18:22:49 I want to show that one person's ray tracer 2024-07-20 18:25:36 I'll probably show the editor included in my4th 2024-07-20 18:26:03 I want to do a call to action for people to contribute to an ecosystem that dearly needs some stuff 2024-07-20 18:26:24 like I'd like to see general CLIs easier to make 2024-07-20 18:49:36 question 2024-07-20 18:49:39 why cant we do shit like 2024-07-20 18:49:44 64 width constant 2024-07-20 18:49:49 or something 2024-07-20 18:49:55 i guess because width would be a word 2024-07-20 18:49:58 kinda sucks 2024-07-20 18:51:30 Are you trying to define a constant called width? 2024-07-20 18:51:55 That would be 64 constant width 2024-07-20 18:59:01 yeah i know 2024-07-20 18:59:03 heh 2024-07-20 18:59:11 I just wanted a more forthy way to do it 2024-07-20 18:59:13 like 2024-07-20 18:59:21 64 [string] width constant lol 2024-07-20 19:00:13 Postscript uses a / prefix to indicate a name or symbol i.e. /width 2024-07-20 19:00:37 So it would be something like 64 /width def 2024-07-20 19:24:44 This is a nice guide that "just works": 2024-07-20 19:24:46 https://randomnerdtutorials.com/raspberry-pi-apache-mysql-php-lamp-server/ 2024-07-20 19:24:56 Not one glitch. 2024-07-20 19:25:56 I'm gearing up to use a Pi for a DIY pool controller system. That lightning strike took mine out, and I just refuse to spend the $3k the guy who came out wanted to put a new one in. 2024-07-20 19:26:20 I mean, all it is is switching 24V AC and DC around and monitoring a couple of analog inputs (temp sensors). 2024-07-20 19:27:01 Besides, my wife will like this better - instead of having to hike over to the pool remote she'll be able to run it from her phone. 2024-07-20 19:38:34 My one beef through the whole process was that the Pi OS defaults to ssh access closed. So to get it brought up I had to take it into the media room and use the TV and keyboard I have on the one there to do the initial config and enable ssh. Given how common it is for these things to be used for IoT type projects, it really should have ssh available on first bring-up. 2024-07-20 20:01:24 as they say, the s in IoT is for security 2024-07-20 20:54:13 Heh heh... 2024-07-20 20:54:16 Indeed. 2024-07-20 20:54:25 Well, I'm sure it was initially disabled for exactly that reason. 2024-07-20 20:54:39 And I just happened to have the stuff I needed to cope with it, so it was no big deal. 2024-07-20 20:55:02 But I could easily picture someone getting one that didn't have that setup, and they'd have some hoops to jump. 2024-07-20 20:55:20 Maybe let me suggest that they should offer a "project version" of the OS that has ssh enabled by default. 2024-07-20 20:55:35 Clearly labeled as carrying that security softness. 2024-07-20 20:57:07 I'm going to do some things the old controller didn't (of course it is 13 years old) - I'm going to stow per minute temperature readings and a history of all control activities in that MariaDB tool. 2024-07-20 20:57:17 Because you know - everyone wants to know that. ;-) 2024-07-20 20:58:48 I used a 32 GB microSD card to set it up - may as well do something with that space. 2024-07-20 21:00:55 The four motors in the system and the lights all use relays that are switched with 24V DC. Probably the relay in the heater too, though I don't know that yet. The two valves use 24V AC. Those valves are neat - they know when they've reached full turn and turn themselves off, even if the voltage stays. Three wires - ground, 24V AC on the next wire turns it one way, 24V AC on the third wire turns it the 2024-07-20 21:00:57 other way. 2024-07-20 21:01:17 So no timing / sensing required. 2024-07-20 22:12:10 zelgomer: My opinion on structs, it works well enough if you just allow saying you're 'using' a struct in certain scopes, and then error out using a member only if there's ambiguity (if there's more than one member with same name in scope, and they have different offsets) 2024-07-20 22:12:19 That way you don't need to track types of objects 2024-07-20 22:12:47 Also all aggregates just resolve to an address, so there's no 'aggregate' objects as a first class type 2024-07-20 22:13:06 And the dot operator is just arrow operator in C, there's no real dot operator 2024-07-20 22:13:19 This is my design for my "new B" 2024-07-20 22:14:11 And naming the struct like e.g. 'struct T' resolves to the number of cells in the struct 2024-07-20 22:14:25 And puts it in scope 2024-07-20 22:14:38 Unless the name is ALL_CAPS in which case I treated it as opaque, like FILE 2024-07-20 22:15:10 Unless you explictly 'use' the struct, which I decided you can do with e.g. 'using ALL_CAPS;' 2024-07-20 22:15:56 Using a struct at file scope makes sense in the module associated with a struct when doing data-abstraction style programming 2024-07-20 22:16:09 Otherwise using structs in functions that need them 2024-07-20 22:16:50 I've demonstrated in my own example code that structs can work well this way, without tracking any types of objects 2024-07-20 22:17:18 Happy to share more about this design if you're interested because I don't have time to work on it myself 2024-07-20 22:18:15 it sounds similar to most functional languages where data structure members become functions. i guess that's basically the forth way, as well. except instead of functions, you're creating a table of symbols that are allowed to follow the dot 2024-07-20 22:19:30 I've not thought of it that way before 2024-07-20 22:20:21 when you define a struct, is it just a tuple of cells, or can you specify member sizes? 2024-07-20 22:20:45 And that's a very good question, not sure if you realise why 2024-07-20 22:20:56 But yes you can specify member sizes 2024-07-20 22:21:08 You can make an array rather 2024-07-20 22:21:21 Everything is a 'cell' in B-style languages and you really want to lean into that 2024-07-20 22:21:26 well the "why" why i'm asking is because there are no types :) 2024-07-20 22:21:34 I just provide char()/lchar() for setting bytes 2024-07-20 22:21:38 As B did 2024-07-20 22:22:40 The difficulty is this, arrays are just a pointer. So you can do: arr = {1, 2, 3, 4}; and arr is the address of that array 2024-07-20 22:23:23 So arr[3] is 4 etc 2024-07-20 22:24:46 But if I have `struct example { arr[4]; }` then do `obj = [struct example]{};` then `obj.arr` is the first element of that array, unless I track arr's type which I'm trying to avoid doing 2024-07-20 22:25:33 You can either remember that arr is an array, which makes sense to some extent as it's a member so needs 'tracking' anyway, and doens't need type-checking of the actual objects themselves 2024-07-20 22:26:35 Or you can say you need to do `struct example { arr[4 + 1]; };` and `obj = [struct example]{}; obj.arr = &(&obj.arr)[1];` or something crazy like that 2024-07-20 22:26:52 So allocate an extra cell and initialise it as the address to the rest of the array 2024-07-20 22:27:30 This is actually, by the way, how B works. A vector was just a normal variable that allocated a load of extra cells after it, and you could actually assign to that address variable and change it 2024-07-20 22:30:42 vector being B's name for an array 2024-07-20 22:31:07 Because it was one-dimensional, B would need a type system to track 2+ dimensional arrays 2024-07-20 22:32:05 interesting. thanks 2024-07-20 22:33:12 And that syntax with square brackets just specifies the size of array to allocate, so a struct is an array 2024-07-20 22:33:37 As I said no aggregates are first-class, they're all referenced by address 2024-07-20 22:34:45 right 2024-07-20 22:39:53 If you call a variable then it assumes the *address* of the variable is the address to call, so fn_ptr() doesn't work, (*fn_ptr)() is necessary. 2024-07-20 22:40:08 fn_ptr() literally would mean "CALL &fn_ptr" 2024-07-20 22:40:54 This is so you don't need a variable to exist containing function call address for every function 2024-07-20 22:41:49 And I believe this is why that syntax with unnecessary * for function pointer calls is allowed in C, it was probably *required* in B for above reasoning 2024-07-20 22:41:50 also interesting. hadn't thought of that one. 2024-07-20 23:42:44 what do you guys want to see in a forth video 2024-07-20 23:42:55 forth 2024-07-20 23:43:18 come on 2024-07-20 23:43:25 it's a video to sell forth to the world 2024-07-20 23:43:28 you got one shot 2024-07-20 23:43:37 tell me what you think will convince everyone 2024-07-20 23:45:05 reentrancy