2024-11-23 00:06:47 You know, I actually understand that, I think. It's HARD to write really graceful Forth, and it's really easy to write tacky hard to read Forth. So it's not surprising a lot of folks that just dip their toe in get a negative impression of it. 2024-11-23 00:10:54 And my bet is that no one writes gracefujl Forth until they've gained a good bit of experience. It's not the kind of thing you just sit down and do. I think I've written some bits of good Forth, but plenty of not so good Forth, and that's even with having done my very first programming on a stack device. 2024-11-23 00:11:22 At least that part of it - getting the stack to behave in a reasonably good way, has always been fairly intuitive for me. Probably because of that early exposure. 2024-11-23 00:15:04 But the training material for the calculator, while it did explain subroutines, had no emphasis at all on "factoring" for factoring and readability. And you could only see one instruction at a time on the screen, so programs wound up being long stringy things. 2024-11-23 00:15:18 And no return stack access. 2024-11-23 00:41:12 KipIngram: I find even the best Forth to be harder to read than the equivalent C. I don't just mean my own code, which may not be very good, but also things like F83, eForth, and GForth. I haven't checked out ChipWits yet 2024-11-23 00:49:03 Well, like I said, I think it's hard to write such code so it's probably rare. I do think it's POSSIBLE. 2024-11-23 00:49:56 I've found my code easier for me to go back and read like a year later since I started using the conditional returns. Somehow that approach just really resonates for me. 2024-11-23 00:54:35 I think Forth is hard to write but easy to read, that's been my own experience 2024-11-23 00:55:06 And I think it's easy to read because you're forced to make it so, just to cope with the task of writing it in first place 2024-11-23 00:56:31 I think once you're comfortable with stacks and RPN, then it can become easy to hack out some code, but then that's likely hard to read. Writing easy to read Forth is hard, though. 2024-11-23 00:56:58 So yeah, easy to read and hard to write go together. 2024-11-23 00:58:49 I actually think the more experienced the Forther, the harder to read their code is! 2024-11-23 00:59:00 Although it may be more maintainable for themselves 2024-11-23 00:59:47 Inexperienced forthers write code I find easier to understand, even if they spit it out 2024-11-23 01:00:16 Maybe we all think the same way at first, it's a weird one 2024-11-23 01:00:51 Maybe also inexperienced people are solving simpler problems because they're new 2024-11-23 01:01:35 I will just say it's often stated that Forth is write-once-read-never, and I've not found that myself 2024-11-23 01:11:16 I wouldn't agree that Forth is write-once-read-never 2024-11-23 01:13:59 but I also don't think it's as easy to read as pop infix languages. f(a[i-1], g(x, y)) can be more or less mechanically translated into i 1- cells a + @ x y g f but doing the reverse translation requires knowing the definitions of f and g 2024-11-23 01:15:13 and if you decide to define a with something like : carray create cells allot does> swap cells + ; 37 cells a it gets shorter but potentially harder to read: i a @ x y g f 2024-11-23 01:16:22 there's a kind of inherent tradeoff between flexibility and readability. the fact that you can make i a @ x y g f mean something totally different by redefining a, x, y, f, and g makes that code more flexible, but by the same token, harder to understand 2024-11-23 01:17:23 it could also mean, for example, f(i, *a, x, y, g) or a[i], f(x, g(y)) 2024-11-23 01:19:04 that doesn't mean it's hopeless to try to understand it, just that you have to do more mental work 2024-11-23 01:24:22 xentrac: I think that might vary from person to person and depends a lot on HOW comfortable you are with RPN. 2024-11-23 01:24:47 Kind of like how you can learn a foreign language and stumble around with it, or you can REALLY learn it and be fully fluent. 2024-11-23 01:31:50 I don't know. I think my example is pretty objective and doesn't vary from person to person 2024-11-23 01:31:53 https://termbin.com/7d4t 2024-11-23 01:32:11 but I was fighting with curses because I forgot to s" curses" add-lib 2024-11-23 01:32:23 any person who learns pop infix syntax can trace the dataflow in f(a[i-1], g(x, y)), and nobody can trace the dataflow in i a @ x y g f until they know the stack effects of a, x, y, g, and f, I think, KipIngram 2024-11-23 01:32:36 and thought I might be writing something wrong or missing some libraries 2024-11-23 01:33:00 you can guess but there's a degree of flexibility there that's just absent in the pop infix syntax 2024-11-23 01:33:18 yay you got curses addch to work! 2024-11-23 01:33:31 congratulations! 2024-11-23 01:33:35 :D 2024-11-23 01:33:57 what do you guys think about : x ; 2024-11-23 01:34:05 does it make you cry? 2024-11-23 01:34:13 no, it seems perfectly cromulent to me 2024-11-23 01:34:14 I do not really know what to think about it 2024-11-23 01:35:07 I'd probably just create values called x and y, or maybe p->x and p->y 2024-11-23 01:35:19 or a 2variable called pos or something 2024-11-23 01:35:47 I need to add life also 2024-11-23 01:35:49 and maybe speed 2024-11-23 01:36:12 or like I did in wmaze.fs where I combined both of them into a single value 2024-11-23 01:36:36 yeah I saw something weird there 2024-11-23 01:36:43 oops I meant i 1- a @ x y g f 2024-11-23 01:36:45 sory 2024-11-23 01:36:47 *r 2024-11-23 01:40:40 you can handle up to 256×256 in a single 16-bit value or variable (or up to 128×512 or whatever), and on a 32-bit system, it's up to 65536×65536 (etc.) 2024-11-23 05:25:41 what are your thoughts on variables vs values 2024-11-23 05:26:14 I like that values push their value directly, but I dislike that if I make a general operator it won't work for them 2024-11-23 07:48:04 xentrac: People don't tend to use names like f g etc, and there's a million ways to write that better including using stack comment for the word itself, which helps guess what the words involved do 2024-11-23 07:48:39 I agree your example is hard to read, but I don't think it's realistic 2024-11-23 07:50:52 Can also use spacing to help group stuff visually 2024-11-23 07:50:52 Maths is the worst though, usually. That bit's not contrived! 2024-11-23 07:51:02 Algebra etc 2024-11-23 07:54:13 i 1- cells a + x y g f \ already a bit easier to read 2024-11-23 07:55:15 i 1- cells a + @ x y g f I mean 2024-11-23 07:55:59 And then with ( -- n ) above and a meaningful name we're doing a lot better 2024-11-23 07:58:16 vms14: values are quite acceptable to people, I don't mind them, it's just annoying you don't get a way to get the address of the var if you ever need it 2024-11-23 07:58:51 And it feels 'new' to me, so I don't use it in retro code 2024-11-23 08:02:00 my main problem is that for example if I make a simple operator like : increment 1 swap +! ; I cannot use it with values 2024-11-23 08:02:31 then it depends whether I will use those operators or not in that value/var 2024-11-23 08:02:57 but then I have mixed values and variables in code and adds load because I have to remember which one is what 2024-11-23 08:03:20 so at the end, variables it is 2024-11-23 08:06:50 Yeah same here lol 2024-11-23 08:15:45 Also @ makes it clear it's a variable 2024-11-23 08:25:22 veltas: those are all basically just comments. they don't affect what the code does. I agree that you can make your *intent* very clear in Forth, but when I'm debugging or reviewing or auditing or modifying code, I need to know more than what the author intended it to do; I also need to know what it actually does 2024-11-23 08:31:13 (of course, in pop infix languages, you can still have additional dataflow paths behind the scenes through things like global variables) 2024-11-23 08:34:11 in the limit I could just write hexadecimal machine code with extensive comments, which is a thing people have certainly done 2024-11-23 08:35:13 Chuck Moore tried just writing evrything in machine code for a while in the 90s 2024-11-23 08:36:53 smithforth did that 2024-11-23 08:37:59 I think you might be missing the point a bit 2024-11-23 08:38:55 well, I think it might just be that we are talking about different objectives 2024-11-23 08:39:04 Like you can't really have loads of Forth that doesn't work, so you're assuming it works as you go. 2024-11-23 08:39:14 For maint 2024-11-23 08:39:32 tests do help 2024-11-23 08:41:43 wrt increment, btw, vms14, x 1+ to x is about equivalently verbose to x increment and more transparent 2024-11-23 08:42:19 but I do wish there was a standard way to take the address of a value 2024-11-23 08:45:07 Yeah there's no good reason not to support that 2024-11-23 08:45:34 xentrac yeah it was just a random example of the stupid operators I make xd 2024-11-23 08:45:49 I think most 'serious' forths with value have a way 2024-11-23 08:45:51 the thing is that you should make both versions or stick to one 2024-11-23 08:45:57 in GForth you can use >body 2024-11-23 08:46:10 which will work in many Forths 2024-11-23 08:46:25 there just isn't a standardized word forit 2024-11-23 08:46:52 vms14: which others have you found useful? 2024-11-23 08:48:03 right now nothing comes to mind, except for the "circular increment" word I made once which I do not have now 2024-11-23 08:48:11 42 value answer ' answer >body ? 42 ok 2024-11-23 08:48:11 69 ' answer >body ! answer . 69 ok 2024-11-23 08:48:18 OFF and ON are good 2024-11-23 08:48:21 oh it was not setting anything so it does not count 2024-11-23 08:48:56 but you gave it the limit and the value and will increment or set it to 0 if is bigger than that value 2024-11-23 08:49:23 that way if you are using that value as index you will treat a region of memory as circular 2024-11-23 08:49:32 hmm, can you implement off for a value with postpone to? 2024-11-23 08:49:57 there was a circular decrement which did the same but to decrement and set it to the limit if it was 0 2024-11-23 08:51:30 I used that to move the snake since I only had to move the last part of the tail to where the head would go and make that the head 2024-11-23 08:52:56 I feel like my understanding of compilation and interpretation semantics is too weak for this question, but I was thinking that you could say clear answer to set the value answer to 0, like answer off for a variable 2024-11-23 08:53:52 but : clear 0 postpone to ; at least doesn't work (in GForth) 2024-11-23 08:54:11 (in interpretation mode) 2024-11-23 08:55:11 vms14: that makes sense 2024-11-23 09:00:28 hmm, there's a specific prohibition in the standard on postpone to: https://forth-standard.org/standard/core/TO 2024-11-23 09:21:46 Yeah TO is state-smart 2024-11-23 09:21:54 Thanks Obama 2024-11-23 09:22:43 That's the other dirty detail of VALUE , just now remembering more reasons I avoid it 2024-11-23 09:23:25 So lack of leadership by Forth committees has lead us here 2024-11-23 10:18:17 I can understand why chuck dislikes the standard 2024-11-23 10:18:28 not only kills creativity and improvement of forth 2024-11-23 10:18:46 it carries random decisions that he does not agree with 2024-11-23 10:19:05 neither do most other people 2024-11-23 10:19:42 and is bloated 2024-11-23 10:19:44 xd 2024-11-23 10:45:00 also making a standard against his will is quite a bad attitude 2024-11-23 10:45:18 who gave them authority over forth? 2024-11-23 10:45:46 and how it is that they did what they wanted knowing his author was against thar 2024-11-23 10:45:50 that* 2024-11-23 12:18:20 Well there's no authority, you don't have to use it 2024-11-23 12:18:30 And most of us don't 2024-11-23 14:55:12 i don't think they created it against his will 2024-11-23 14:55:56 i've gotten the impression by things he's said that he's been involved with it before 2024-11-23 14:58:07 i think at some point he simply decided that standardization was not adjacent to what he was doing, so they went separate paths 2024-11-23 14:58:33 he doesn't want to be confined to a standard 2024-11-23 15:23:17 sometimes it's helpful to know which behaviors are common to most Forths and which are, say, GForth features