IRC Log - 2025-10-18 - ##forth

Channel: ##forth
Total messages: 15
Time range: 19:37:14 - 22:09:25
Most active: arbe (4), vdupras (4), somelauw (3)
19:37:14 ##forth <somelauw> I was philosophizing about stack-based and the was thinking about comparison operators. Many algorithms start by duplicating the top argument(s). Would it perhaps make sense for operators like > to just leave the top two items on the stack and just add a flagresult on top?
19:48:07 ##forth <arbe> Not sure about making it the default, but it's a useful option for sure -- UXN, a Forth-inspired virtual stack machine architecture, reserves a flag bit in its instruction encodings specifically for this purpose, and it does make certain things somewhat easier to write
19:48:48 ##forth <vdupras> Yeah, such approach can indeed speed up things, but you do end up with a whole new set of words (2dup> 2dup= etc.). If this kind of optimization was indeed worth it, I think it'd rather pimp up the compiler with a single lookahead as well as a lookup table.
19:49:05 ##forth <vdupras> When it sees "2dup >", it instead compiles the replacement word in the table
19:49:48 ##forth <vdupras> This way, you don't have to expand your vocabulary only for speed purposes
19:50:51 ##forth <vdupras> Another good lookahead is "<anything> ;" that can be replaced by a jump instead of call+return
19:51:18 ##forth <arbe> the good ol' tailcall
19:54:52 ##forth <somelauw> yeah i was wondering if forth were redesigned, whether it would be a better or equally good default. But itt does mean you need something like "> drop drop" when you don't need it
19:57:15 ##forth <arbe> in my experience the words' consumption of stack arguments feels really core to Forth's identity as a language
19:57:59 ##forth <arbe> I often find myself writing words which don't necessarily *need* to drop their arguments, but do so anyway just because it feels more idiomatic
20:03:14 ##forth <cleobuli_> forthBot: S" somelauw qui se prend la tête devant son ordinateur "S IMAGE
20:05:38 ##forth <somelauw> hmm, consistency matters, although some dialects do have a print-command that doesn't drop
22:03:30 ##forth <forthBot> Environment for cleobuli_ inactive, freeing...
22:09:25 ##forth <ajhidd> I'd vote either for every forth word to consume the value(s) on the stack or mark "keeping" words explicitly like Uxntal does. Some time ago I tried a forth-like PL that had it all - both consuming and keeping words intermixed. It was quiet hell. I could never write a single statement with certainty. I had to try everything in REPL first.