2021-10-18 07:48:59 Looking at youtube videos of people using Forth and everyone is using the 2008 release of gforth 2021-10-18 07:49:35 Imagine having a project that you put loads of effort into but can't be bothered to promote your new releases for or get them onto distros 2021-10-18 07:50:20 isnt the windows version several versions behind? 2021-10-18 07:50:35 I've only seen people using it on Linux 2021-10-18 07:50:41 Or a UNIXy system 2021-10-18 07:51:09 The Debian, Ubuntu etc versions are the last 'release' that isn't just a snapshot, which is from like 2008 or something 2021-10-18 07:52:07 The current snapshot is lightyears ahead, implements the entire new standard and has a 'deadzone' status bar, and implements proposed standard features 2021-10-18 08:15:05 Yeah, feels like some other projects which switched from periodic semver releases to rolling development release and forget to tell anyone. 2021-10-18 08:19:35 what do they use it for? 2021-10-18 08:19:38 @ veltas 2021-10-18 08:23:14 f-a: Tutorials 2021-10-18 08:23:29 There are a couple of Forth tutorials 2021-10-18 08:24:01 They're quite inaccurate because people make them as a sort of learning exercise 2021-10-18 08:35:42 lol 2021-10-18 08:35:51 tutorials are not good output 2021-10-18 10:45:27 There's nothing inherently wrong with them, some of them are quite good. I don't see why a YouTube tutorial can't be good either 2021-10-18 10:45:46 It's just not happened for Forth, what's there is still probably somewhat helpful to people 2021-10-18 10:45:58 no I mean 2021-10-18 10:46:03 when I check a new language 2021-10-18 10:46:10 and all I see are tutorials 2021-10-18 10:46:14 I am not happy 2021-10-18 10:46:18 I want to see end product 2021-10-18 10:47:18 There are already a number of videos about Forth in usage online 2021-10-18 10:48:19 that punyforth screencast was a good demo 2021-10-18 11:12:26 <_inky > i have dev-lang/gforth-0.7.3-r2 in my gentoo. 2021-10-18 11:12:31 <_inky > don't know if that's old or new. 2021-10-18 11:13:07 <_inky > f-a: gforth contains example sources, even sudoku game source. 2021-10-18 11:20:46 That's the last stable release, which is quite old. It's the latest in FreeBSD ports, also. 2021-10-18 14:16:48 MrMobius, been re-reading Noble's "A Beginner's Guide to Forth" ! Good stuff. Worked through your C vs Forth xmpl. Grokking it better now. 2021-10-18 14:17:25 never read it 2021-10-18 14:17:28 is it free online? 2021-10-18 14:17:47 f-a, it is! Hang on ... 2021-10-18 14:18:20 grazie 2021-10-18 14:18:21 f-a, http://galileo.phys.virginia.edu/classes/551.jvn.fall01/primer.htm 2021-10-18 14:19:19 thanks! 2021-10-18 14:19:40 dukester, neat 2021-10-18 14:19:47 Seems to me that Learning and using Forth means getting very familiar with RPN 2021-10-18 14:19:52 can you tell me where the c vs forth comparison appears? 2021-10-18 14:20:03 very much so dukester :P 2021-10-18 14:20:23 as much as playing football means getting acquainted with a round ball 2021-10-18 14:20:25 f-a, I think dukester might mean the example i gave him a few days ago 2021-10-18 14:20:43 that's it! 2021-10-18 14:21:03 dukester, have you gotten to @ yet? 2021-10-18 14:21:09 ohhh,, can you share it again MrMobius ? 2021-10-18 14:21:44 MrMobius, I have - recalls a memory address 2021-10-18 14:21:59 f-a, print("%d",X*X+3*X-5); 2021-10-18 14:22:08 ah that one! 2021-10-18 14:22:40 dukester, so do you see why dup is useful in "X @ dup *" rather than "X @ X @ *" ? 2021-10-18 14:22:43 BTW the Forth equivalent needs an + at the very end 2021-10-18 14:23:47 Sure! we're setting up the stack in order to perform the operations in order of precedence 2021-10-18 14:25:07 true but if we were just doing X*X and there was nothing else, do you see why you'd want to be able to use dup? 2021-10-18 14:26:24 well you could enter the value twice into the stack - or once and then dup it. 2021-10-18 14:27:10 not really then! 2021-10-18 14:28:34 for one it's shorter. it also takes less time to execute than going and fetching the value from memory twice 2021-10-18 14:29:02 and when you do other things on the stack, making a copy with dup can save you from having to declare a variable to hold the copy 2021-10-18 14:29:04 sounds reasonable 2021-10-18 14:30:01 That last statement makes a lot of sense to me now! 2021-10-18 14:30:50 So its cheaper to dup than to creaye another var and the use it! 2021-10-18 14:31:51 emacs and gforth! What's the best workflow? 2021-10-18 14:35:50 yes, you should avoid using variables whenever possible 2021-10-18 14:36:11 although youll need quite a lot of them once you get past toy examples 2021-10-18 14:36:29 MrMobius, kinda like lisp and functional programming 2021-10-18 14:37:10 i dont know much about those tbh 2021-10-18 14:46:54 If only I could make money with FORTH 2021-10-18 14:47:24 what are you doing with it instead 2021-10-18 14:47:40 veltas, Are you that good at it that you could? 2021-10-18 14:48:01 Apparently not lol 2021-10-18 14:48:33 I think whether you can make money has something to do with the market for it, and there's not a lot of demand, but I believe there are roles where people make money writing FORTH 2021-10-18 14:49:12 veltas, Forth, Inc might be interested in your abilities? 2021-10-18 14:49:15 I couldn't really justify it at work, where I write low-level C code for proper computers 2021-10-18 14:50:10 I live in the UK and don't want to even move away from where I live right now 2021-10-18 14:50:29 within UK I wouldn't relocate 2021-10-18 14:50:36 Not that there are any jobs at FORTH, Inc 2021-10-18 14:51:27 veltas, would you not likr to write forth code up in Yorkshire moors? 2021-10-18 14:51:52 Too far 2021-10-18 14:52:03 How do you know there's a FORTH job there? 2021-10-18 14:52:26 I don't! just being funny. 2021-10-18 14:52:45 It seems like something that's impossible to look for, but I'm sure there's probably some directories. And then there's people that just know which companies use it 2021-10-18 14:52:54 And they're all a dying breed 2021-10-18 14:54:31 If Forth is as good as some say, then it should be able to make itself indispensable, right? 2021-10-18 14:55:06 Who says? 2021-10-18 14:57:14 forth is a large dialect of languages rather than a single core language. 2021-10-18 14:57:27 that's really the problem here. 2021-10-18 14:57:55 you can't hire for forth in the same way you can't hire for "C-family programming languages" or "ALGOL-likes". 2021-10-18 14:58:30 https://news.ycombinator.com/item?id=9856140 2021-10-18 14:58:37 imode, there's A LOT of specialized dictionaries sure! But Forth can be molded to any specific need - can it not? 2021-10-18 14:59:25 sure, but whether that molding takes more time than doing it in another language is subject to debate. 2021-10-18 14:59:46 instead of maintaining things that "look" idiomatic, people can invent hairy DSLs that sidestep the already minimal syntax of the language. 2021-10-18 14:59:54 crc makes money with FORTH, but I don't presume to be as proficient as crc, and I don't have the network of clients he's got 2021-10-18 15:00:09 Sorry, not 'FORTH', but retro, which is 'a Forth' 2021-10-18 15:00:23 admirable. 2021-10-18 15:00:32 Definitely 2021-10-18 15:01:17 Yeah there is a large issue that even with standard forth, because of the flexible hacky nature of FORTH most code ends up being write-only stuff that only one programmer will ever understand 2021-10-18 15:01:22 Or at least it seems like that to the outside 2021-10-18 15:01:56 the execution model doesn't help. you can excuse some stack juggling but not all of it. 2021-10-18 15:02:03 I find myself being able to understand most FORTH code I find, but people definitely like to put some proper head-scratchers in there sometimes, creative use of rdrop is probably some of the worst 2021-10-18 15:02:55 forth would be okay if people understood how to do DSL design in a "standard"/"idiomatic" way. 2021-10-18 15:02:57 Thane this seems to be a matter of code discipline and coding standards. 2021-10-18 15:03:15 that's correct, and forth says "let the programmer choose", while others enforce structure in other ways. 2021-10-18 15:03:23 industry enjoys structure. 2021-10-18 15:04:33 imode, you bet! and with reason! So Forth self-destructs because the users want to be libertines and cosing anarchists? 2021-10-18 15:04:59 it's more "how much flexibility can you impart onto a language that can hook into its own parser". 2021-10-18 15:05:06 sky's the limit. 2021-10-18 15:05:20 lisp suffers from different problems because everything roughly looks the same. 2021-10-18 15:06:25 but lisp seems to have a hell of a lot more productive than Forth seems to have been. Even emacs-lisp has more to show for itself. 2021-10-18 15:06:58 mainly because lisp empowers you to work at higher layers of abstraction by enforcing a minimal structure. forths can literally do whatever they want. 2021-10-18 15:07:50 coding in assembly then is the same. 2021-10-18 15:10:26 it shows a lot when the first thing you want to do to build something "large" in a language is start redefining its grammar. 2021-10-18 15:11:16 imode, not building ONTO it? 2021-10-18 15:13:53 yeah, not building on top of. 2021-10-18 15:13:59 just straight up redefining things. 2021-10-18 15:15:13 imode, can the core forth grammar be totally redefined that way? 2021-10-18 15:16:32 yup, you can do whateeeeever you want if you can hook into the parser. 2021-10-18 15:16:40 so that looking at the source code of one program might be totally different from another? 2021-10-18 15:17:27 correct. 2021-10-18 15:18:14 dukester: The problem with structure and idioms is sometimes those create way more code, but most people would rather have 10 idiomatic modules to do something that can be written in a tenth of the code 2021-10-18 15:18:22 imode, that explains WHY forth never went anywhere. Only the creator of a program knew the specific lingo! 2021-10-18 15:18:58 veltas, I hear you! 2021-10-18 15:19:43 forth also grew up on tiny systems. those constraints don't apply anymore. 2021-10-18 15:20:28 Most popular programming languages just took what was familiar and improved it. C is very similar to a number of languages that came before, it's an iteration/improvement on those. 2021-10-18 15:20:32 that's why they say that forth is un-maintainable by anybosy but the original inventor of the idioms. 2021-10-18 15:21:25 the biggest mis-step forth had is not having an incredibly adoptable standard library until the ANS standard, and by then it was far too late. 2021-10-18 15:22:11 I think it's just easier to write C than FORTH, anecdotaly people seem to write C much faster than FORTH 2021-10-18 15:22:27 depends on who 2021-10-18 15:23:09 ANS standard notwithstanding - if it's a free-for-all with coding than what have you got really? 2021-10-18 15:23:22 Stack-juggling is harder than just using variables, and maths-style expressions 2021-10-18 15:23:56 I think the variables being the more significant factor, RPN is less of an issue 2021-10-18 15:24:45 yeah the stack juggling sucks ass. 2021-10-18 15:24:51 And no static type rules wastes time 2021-10-18 15:24:59 "if you find yourself doing it, factor!" there is no general solution other than variables. 2021-10-18 15:25:22 When I started learning FORTH I was using { -- } variables and I barely noticed the difference from writing other languages 2021-10-18 15:25:28 static types are annoying 2021-10-18 15:25:32 But that's not 'proper' by most FORTHers 2021-10-18 15:25:59 fuck most FORTHers lmao. 2021-10-18 15:26:27 what is { -- } 2021-10-18 15:26:33 eris[m]: Yes but they save you from stuff like passing the wrong number of parameters, and wrong type of parameters. 2021-10-18 15:26:39 f-a: {: in the standard 2021-10-18 15:27:07 this is why an actual stack arity checker helps. 2021-10-18 15:27:10 Most FORTHs that provided local variables used { as the name 2021-10-18 15:28:27 f-a: Do you want a quick rundown? 2021-10-18 15:30:08 please 2021-10-18 15:31:50 When compiling, something like {: a b :} will pop the top two things off stack, and then the names 'a' and 'b' can be used to push that saved value on stack 2021-10-18 15:32:01 And you can write 'to a' to set 'a' 2021-10-18 15:32:20 And the definition ends and cleans up at end of the definition ';' 2021-10-18 15:32:30 nice 2021-10-18 15:32:32 You can do this multiple times, naming results of words mid-function etc 2021-10-18 15:32:41 can you modify those? 2021-10-18 15:32:44 Yes 2021-10-18 15:32:48 or are they constant- super 2021-10-18 15:32:51 TO 2021-10-18 15:33:00 can be used with them, like with VALUE's 2021-10-18 15:33:31 curious to see the imp. I guess a «pocket» dictionary 2021-10-18 15:33:49 It interferes with the return stack, if I remember rightly, so you can't do it half way through a DO..LOOP or in an RDROP function 2021-10-18 15:34:09 Yes there will be some kind of special dictionary probably, to allow looking up the name 2021-10-18 15:35:14 The gforth example is: : swap { a b -- b a } b a ; 2021-10-18 15:35:19 ans forth has multiple dicts 2021-10-18 15:35:34 probably smth to do w that 2021-10-18 15:36:26 Since it's used mid-definition, I would assume there's some area with a fixed size in the dictionary for local names 2021-10-18 15:37:56 I don't think there's any way of implementing this feature purely with other standard words 2021-10-18 15:38:27 (except the other local variable words, of course -- there was an older iteration of it that sucked and nobody used) 2021-10-18 15:40:03 f-a: Also you can write more names after a pipe '|' in a local definition list and it creates more local variables to use without popping from the stack 2021-10-18 15:40:17 i.e. to just create a local variable without giving it an initial value 2021-10-18 15:41:06 Anyway when I started writing FORTH, I was using this feature, and it just feels like using any other programming language with a weirder syntax. You can write very conventional, structured code this way. It's not really FORTH at that point though. 2021-10-18 15:42:11 reminds me of writing fibonnaci recursively in K! 2021-10-18 15:43:46 How so? 2021-10-18 15:44:38 if:$; fib:{if[(n=1)|n=0;n;o[n-1]+o[n-2]]} 2021-10-18 15:45:07 vs the proper way 2021-10-18 15:46:13 `fib:{1_x(|+\)/!2}` 2021-10-18 15:47:16 k is a great K 2021-10-18 15:47:28 but a shit normal lang 2021-10-18 15:49:46 sum:0; i:0; while[i<100;sum+:i;i+:1] 2021-10-18 15:49:59 \part need grub! 2021-10-18 15:50:18 scratch that 2021-10-18 15:55:15 https://pastebin.com/raw/twYD8Ty1 2021-10-18 15:56:10 f-a: ^ knowing that you can, the question becomes... should you? 2021-10-18 15:59:11 I see 2021-10-18 15:59:30 I need to see a {:less fib now! 2021-10-18 16:03:03 : fib ( n - fib{n}) 1 1 rot 1 ?do swap over + loop nip ; 2021-10-18 16:04:39 \o/ 2021-10-18 16:06:56 With more stack comments: https://pastebin.com/raw/iFu7pJ88 2021-10-18 16:08:30 I tend to use a lot of stack comments, but better forthers than me will say you don't need any, not even word stack comments 2021-10-18 16:08:52 But as a mere mortal.... 2021-10-18 16:10:25 those forthers are wrong ;P 2021-10-18 16:12:27 why so 2021-10-18 16:12:51 what makes your preference right 2021-10-18 16:13:51 that reading that line after 6 months will make your head hurt a bit 2021-10-18 16:14:04 imho the saying: «code is written once, read many times» is true 2021-10-18 16:14:06 at least for me 2021-10-18 16:14:39 The argument is that if it's short, named well, and the nearby definitions makes sense, then it's obvious what the stack usage is 2021-10-18 16:15:07 isnt the argument for forth to refactor often? 2021-10-18 16:15:36 change things 2021-10-18 16:15:49 lol, how absurd 2021-10-18 16:16:03 that stack usage is obvious 2021-10-18 16:16:11 I was watching https://www.youtube.com/watch?v=mvrE2ZGe-rs earlier and he makes a case for not needing the stack comments 2021-10-18 16:16:19 other than variables, that's my biggest gripe 2021-10-18 16:16:29 It was quite an interesting video, seems to work for him, not for me though lol 2021-10-18 16:17:11 refactoring is tough when you care about performance 2021-10-18 16:17:34 probably doesnt matter on x86 but might on embedded 2021-10-18 16:24:31 Anyone here been involved with the Forth2020 group? 2021-10-18 16:27:17 They've had a zoom with Leo Brodie and seem to have Chuck Moore on there regularly 2021-10-18 16:29:46 MrMobius: I know on mecrisp they do aggressive inlining, so refactor as much as you want and it will unroll it all if you're not using the word more than once 2021-10-18 16:33:25 I skim over posts from Forth2020 group, but I'm not really involved with it 2021-10-18 17:00:20 The Leo Brodie interview is good (if you like Brodie's books!) 2021-10-18 17:12:43 veltas, it only unrolls to a degree but ya mecrisp is impressive. only 3x slower than C which is phenomenal 2021-10-18 17:27:24 A certain byte magazine is being brought up as a place people found FORTH in this Leo Brodie interview https://archive.org/details/byte-magazine-1980-08/ 2021-10-18 17:29:41 MrMobius: In my opinion Forth's performance is always sufficient, because when it's not then C isn't really sufficient either. At that point you might as well write certain things in assembly, and you rarely need to write more than one or two words that way anyway after profiling 2021-10-18 17:30:06 Assembly or with a bunch of intrinsics which could just as easily be assembly IMO 2021-10-18 17:38:50 Why do Swiss people always sound British? 2021-10-18 17:41:59 same thing 2021-10-18 17:42:07 i dont know any swiss people who sound british 2021-10-18 21:02:14 veltas, that doesnt make any sense at all. how can you say something 3x slower is always as good as something without the slowdown? and that's considering mecrisp which is the best case possible. on the 6502 its more like 10-20x slower 2021-10-18 21:02:34 thats like saying if something written in python on the pc is too slow then it will be too slow if you rewrite it in C