2022-09-20 00:14:46 If I were trying to go for the most compact code possible, I'd use some sort of variable length encoding (it would complicate NEXT, of course). like may have a 1 LSB indicate a one-byte token; you could have 127 of those. A zero LSB would mean you'd just picked up a 16-bit aligned address, and you'd do the usual thing. 2022-09-20 00:15:10 To avoid having to have a jump table, I'd compute the jump offset from the seven bits of the one-byte tokens. 2022-09-20 00:15:46 You might allow 16 bytes per token value. That would wind up l eaving some gaps, but you could jump to those gaps from other routines and fill them in with code. 2022-09-20 00:16:32 If a routine needed more than 16 bytes, you could just take two code slots, or you could jump off from the end of the entry block to some other spot. 2022-09-20 00:17:03 That lets you have 127 words that are as compact as possible, and that's actually quite a lot. 2022-09-20 06:18:39 KipIngram: what I'm doing now is putting all the tokens that take an argument above a certain number so the dispatcher can load the next byte into a register for them 2022-09-20 06:20:10 I'm doubtful spacing out the tokens like you describe would be more compact but I could give it a try 2022-09-20 06:21:26 If they are 16 byte slots, the code needs to be 14, 15, or 16 bytes, otherwise the 2 bytes in the table are cheaper 2022-09-20 06:21:48 or 30, 31, or 32 bytes if taking up two slots 2022-09-20 06:22:39 I haven't done it yet, but I think whether a word adds or removes an item from the stack can be encoded in the token too 2022-09-20 10:00:00 Yeah, I've never actually tried what I just described; it might wind up having some sort of issue. I did do some "code sharing" when I was working on that one-sector thing a couple of months ago. Whenever two words shared enough "last code" I put it in just one place and jumped to it from the other word(s). 2022-09-20 10:00:33 It's just that that 254 byte table always felt a little painful to me. 2022-09-20 16:55:49 do you dislike this kind of case statement? 2022-09-20 16:55:51 'ah [ [ oh 1 2 3 ] [ meh 3 4 5 ] [ ah 5 6 7 ] [ t 8 9 0 ] ] case 2022-09-20 16:56:10 t is 'default' will be triggered when no other case matches 2022-09-20 16:56:29 do you prefer the forth one? 2022-09-20 16:58:08 the if is similar, taking a list as code instead, and there's no else in the if, but a separated word named if.else taking two lists 2022-09-20 16:58:24 1 [ " is one" . ] if 2022-09-20 16:58:46 1 [ " is one" . ] [ " isn't one :/" ] if.else 2022-09-20 16:59:21 instead of: 1 if ." is one" else ." isn't one :/" then 2022-09-20 16:59:37 I kind of prefer the list based one 2022-09-20 17:00:18 indentation works, but even without it the list based one seems more readable 2022-09-20 17:01:30 but for example with cond could get a bit annoying 2022-09-20 17:02:46 1 [ [ [ 1 eq ] 1 2 3 ] [ 2 eq ] 4 5 6 ] [ 3 eq ] 7 8 9 ] ] cond 2022-09-20 17:03:40 it's wrong, needs more [ in between xD 2022-09-20 17:05:04 like this: [ [ [ 1 eq ] 4 5 6 ] [ [ 2 eq ] 7 8 9 ] [ [ 3 eq ] 1 2 3 ] ] cond 2022-09-20 17:05:30 seems to be a bit annoying 2022-09-20 21:35:33 Uh, it's... too opaque. Just a wall of stuff, without any intuition to it. Maybe it needs to be factored, with sections given names that carry meaning about what's going on. 2022-09-20 21:35:47 The logic may be totally fine, but I can't *see* the logic. 2022-09-20 21:36:50 KipIngram: do you refer to my cond syntax? 2022-09-20 21:37:31 it is like this now: https://termbin.com/u75m 2022-09-20 21:37:35 In my NUMBER, when I was converting ascii characters to digits, I had a word in there that had something like ... 0-9? A-Z? a-Z? ... 2022-09-20 21:37:40 not really very different 2022-09-20 21:37:45 i could have spooled the definitions of those out into one 2022-09-20 21:37:59 long definition, but it wouldn't have conveyed any sense of what what being done. 2022-09-20 21:38:32 (Actually I *couldn't8, because I use conditional returns a lot, but in a regular Forth equivalent situation I'd be able to unroll them like that0 2022-09-20 21:38:58 But I think the factoring makes it easier to understand what's happening. 2022-09-20 21:40:39 Those words above all work the same way - if the character *was* in the range 0-9, then 0-9? would digitize it and double return the value. otherwise it it adjusted the value and single-returned. Then A-Z would take a shot, and if that failed a-z would have a go at it. 2022-09-20 21:40:48 If they all failed then it would throw an error. 2022-09-20 21:41:24 The "adjustments" handled the skipped characters between 9 and A and between Z and a. 2022-09-20 21:42:40 But I'm probably a bad person to ask about this - I've swallowed the 'factor, factor, factor' pill whole hog. These days if a definition is longer than 50 characters or so I'm unhappy. 2022-09-20 21:43:09 40 is even better. ;-) 2022-09-20 21:44:06 that's why I fell in love with colon words I guess 2022-09-20 21:44:37 yet mine will be super slow and won't be as nice as in a real forth where you're encouraged to factor 2022-09-20 21:45:40 but hey, what did you want performance after all :D 2022-09-20 21:45:44 why* 2022-09-20 23:09:18 I actually think that a strong case can be made for the strategy of s pending performance for clarity. Given the general state of software quality, anything that helps you write better code seems like a good idea. 2022-09-20 23:10:03 If a small amount of call/return overhead can help me keep better track of what I'm doing, I'm ok with that - up to a point. A lot of things that humans interact with only need to be so fast, and as long as you're that fast you're fast enough. 2022-09-20 23:10:55 In Halt and Catch Fire they said 400 ms, for something a human waited for after hitting I imagine someone who was trying to pay attention could gauge s horter times, but they were talking about how we react when we're just going about our business, not when we're trying to be a stopwatch. 2022-09-20 23:21:36 in my case to write shitty apps or user gui applications it "should" be fine 2022-09-20 23:21:53 but I wonder what will happen when I need to serve websites and alike 2022-09-20 23:22:15 I can put it inside apache btw, but the language will be slow anyways