2024-05-14 16:00:21 I've seen a lot less resistance to prefix arithmetic 2 2 + than postfix (+ 2 2). Maybe HP calculators had something to do with it. 2024-05-14 16:03:52 i think your pre- and post- are crossed 2024-05-14 16:11:11 yes, that. 2024-05-14 16:11:24 ACTION drinks more coffee. 2024-05-14 16:55:27 Prefix leaves each operator having to deal with the input stream. Which, I suppose is fine, but it just feels a lot more sensible to have the operands already available, parsed and ready to act on. I suppose prefix would make it easier to work with a wider range of input formats - a word could take any input that it knew how to parse. 2024-05-14 16:55:40 And yes, I expect HP calculators did have to do with it - they sure did for me. 2024-05-14 16:56:20 I was sold on RPN as soon as I got my hands on such a calculator, and to this day I'm clumsy on standard infix calculators. 2024-05-14 16:57:11 I saw a guy reviewing a calculator on Numberphile a few days ago, and he kept wanting to enter "2 " when the calculator needed 2. 2024-05-14 16:57:27 I couldn't help wondering if he is also an RPN calculator user and kept slipping into "habit." 2024-05-14 16:59:14 The problem with prefix is that while it works smoothly enough on direct input, I'm not sure I see how you "program" with it. A + in the middle of a program would not be getting its operands from the input stream, whereas one you typed would be - they're entirely different operations. 2024-05-14 16:59:48 You'd have to have some elaborate structure that remembered you had a + pending while you went forward and formed up the operatnds. 2024-05-14 17:00:30 And that would in theory be an unlimited amount of work - you couldn't even be guaranteed that you had enough resources to finish. 2024-05-14 17:01:04 So it would certainly be a much more complex software system than Forth is. 2024-05-14 17:01:24 Infix faces the same issue, though maybe only "half as bad." 2024-05-14 17:01:26 AST. very dangerous. you go first. 2024-05-14 17:02:27 lol 2024-05-14 17:02:27 Yeah, some of the ASFs I've seen in Aaron Hsu's videos get wildly complex. 2024-05-14 17:02:39 (APL) 2024-05-14 17:04:12 well, can we say that Forth operates on a stack of single operands, while APL operates on a stack of vectors of operands? 2024-05-14 17:04:18 or its too hazardous? 2024-05-14 17:06:38 I wouldn't quite say that - you're right that APL can work with more complex entities than Forth can. But APL still doesn't have a model where at the time you encounter the operation the data is already situated somwhere. At least not when you consider a linear scan of the input. 2024-05-14 17:07:08 APL processes lines right to left instead of left to right, but operations still take operands from "ahead in the input" - it's just to the left instead of to the right. 2024-05-14 17:07:51 i see 2024-05-14 17:07:56 I think real postfix has an inherent simplicity that the others just don't. The APL way does allow it to have operations be either unary or binary (same symbol) - that's hard in postfix. 2024-05-14 17:08:08 You put something on the stack, but how do you know which operand is going to use it? 2024-05-14 17:08:14 (you don't) 2024-05-14 17:08:26 yeah i totally agree 2024-05-14 17:25:33 KipIngram why i see now a + on your name? 2024-05-14 17:25:41 you are more important now? :0 2024-05-14 17:27:41 he's got the "voice" bit on 2024-05-14 17:27:53 it allows him to talk if the channel becomes moderated 2024-05-14 17:28:20 ty 2024-05-14 17:28:27 i was looking at the rfc xd 2024-05-14 17:28:32 has been granted permission to speak on a moderated channel 2024-05-14 17:29:01 i knew about the @, but thought the + didn't show up 2024-05-14 17:29:12 I made a discussion bot once that would moderate a discussion using v modes 2024-05-14 17:29:18 so yes, he is more important now 2024-05-14 17:29:21 :D 2024-05-14 17:30:59 btw the fact i don't know the operator that's going to use the value is a curse and a blessing for me 2024-05-14 17:31:16 blessing because you put stuff on the stack and don't give a fuck about who uses it 2024-05-14 17:31:24 curse because i have 0 control 2024-05-14 17:31:49 why don't you have control? 2024-05-14 17:32:03 it makes a bit harder to transform rpn code to non rpn code 2024-05-14 17:32:54 zelgomer because i try to make the "core interpreter" as dumb as possible, i let the words take care about everything 2024-05-14 17:33:20 but since the interpreter is dumb, the words have to cooperate between them to give info 2024-05-14 17:33:41 or not having info at all 2024-05-14 17:34:07 this is true of any language. code has to agree on interfaces in order to work. 2024-05-14 17:34:08 mainly when i want to generate code is that i don't know when a statement ends 2024-05-14 17:34:35 there is no more parser than to read by words 2024-05-14 17:34:43 no ast 2024-05-14 17:35:28 i don't know if i should put a semicolon on the target language code i'm trying to generate 2024-05-14 17:37:08 i don't understand this. the statement ends when you need it to. you have control of your output. 2024-05-14 17:37:51 1 2 + => 1+2 ; 1 2 + 3 + 4 5 + + => ? 2024-05-14 17:38:04 you parse "over". you generate the necessary code to make the semantics of over happen, and you emit a semicolon when you need to 2024-05-14 17:38:55 i can if i know exactly how many elements a word takes and returns 2024-05-14 17:39:08 push(1); push(2); add(); push(3); add(); push(4); push(5); add(); add(); 2024-05-14 17:39:20 yeah, it forces me to make a stack on the host lang 2024-05-14 17:39:32 i saw a chinese guy doing that 2024-05-14 17:39:56 but i would like to avoid it if possible, it does not feel right 2024-05-14 17:40:19 target lang* 2024-05-14 17:41:57 if you want to generate optimized code, then you need to define primitives and sequence points. primitives (such as stack jugglers and arithmetic) manipulate temporary "registers" (which are probably variables in your target language), and this is all staged in data structures at parse time (something approaching an AST). then, when you encounter a sequence point, you walk your data structure and emit 2024-05-14 17:42:03 optimized code and reconcile the target's stack 2024-05-14 17:42:13 i should go that way anyways 2024-05-14 17:42:38 i would suggest KISS, make it work first. then optimize. 2024-05-14 17:43:24 the other idea is to add more data into every word, knowing how many elements they take from the stack and how many they return 2024-05-14 17:44:02 but i complicate things also by having a compile time language and an execution language 2024-05-14 17:44:11 runtime* 2024-05-14 17:44:24 brb 2024-05-14 17:44:41 "1 2 + 3 + 4 5 + +" can be represented as an AST, by the way. that's (+ (+ (+ (1 2) 3) (+ 4 5)) 2024-05-14 17:54:32 vms14_: I realized yesterday that I wasn't actually logged in. I sent chansrv an "identify" messae and I guess it made me more "officially me." 2024-05-14 17:54:40 I think I've had a + here for a long time, actually. 2024-05-14 17:54:54 Just wasn't showing up because I was running unauthenticated. 2024-05-14 17:55:11 That's my guess at least - I don't know that much about such things. 2024-05-14 18:00:28 I think that + was there even back in the Freenode days - no recent changes. 2024-05-14 18:04:12 ah, then you are verified now, KipIngramOfficial, like the influencers 2024-05-14 18:04:39 I suppose. :-) 2024-05-14 18:04:48 zelgomer now give that result to another function 2024-05-14 18:05:13 you don't know how many items the function wants 2024-05-14 18:05:27 nor how many they return 2024-05-14 18:06:32 and whether the arguments are made by a sequence of statements or only one 2024-05-14 18:08:02 i think i should just add the metadata on every word to know exactly how many elements they return and take 2024-05-14 18:12:09 arity 2024-05-14 18:20:02 vms14: giving the result to another function is what i referred to earlier as a sequence point. let me put it this way: imagine how a c compiler works. it builds some expression, and then when it's time to call a subroutine or return from one, the ABI passes those parameters through registers, so at that point it has to resolve those expressions and generate code to populate the appropriate registers 2024-05-14 18:20:09 with the appropriate values. you have the exact same concept, but in forth, the ABI is stack-based, not register based. when you encounter a sequence point (calling a high level word, returning from a word, branching, etc.), you resolve your staged expressions and generate code to make the stack "right". 2024-05-14 18:22:01 then it requires knowledge of the whole code 2024-05-14 18:22:23 no... 2024-05-14 18:23:07 do you think that when you call printf, the c compiler knows how printf works when it compiles your source? 2024-05-14 18:23:49 no, it needs just a declaration 2024-05-14 18:24:25 it only needs a declaration for type checking 2024-05-14 18:25:02 what would swap do? 2024-05-14 18:25:49 it would manipulate your AST or whatever we're calling it 2024-05-14 18:25:59 it wouldn't actually emit anything yet 2024-05-14 18:26:13 changing the parameter order of the function? 2024-05-14 18:26:40 you don't have parameters or functions, you have a stack 2024-05-14 18:28:22 learning enough about assembly to be dangerous might be handy 2024-05-14 18:28:57 then i have no idea, but i don't want to make you loose more time trying to explaing it and i should research it for myself instead 2024-05-14 18:30:05 thrig i always had to, but never did 2024-05-14 18:31:14 the only thing i've learned in assembly was to make a program that exits 2024-05-14 18:33:37 I wrote echo(1) in assembly, it was 5 to 50% faster than the echo shipped by Apple 2024-05-14 18:34:02 the fastest hello world in the world 2024-05-14 18:34:04 the forth difference is that if you violate the word's contract, it doesn't halt execution 2024-05-14 18:35:04 and I think that's the aspect of it that makes people uneasy 2024-05-14 18:35:07 "A Reddit clone in two evenings and 666 lines of x86 assembly" https://old.reddit.com/r/programming/comments/b0a2z/a_reddit_clone_in_two_evenings_and_666_lines_of/ 2024-05-14 18:36:30 the 666 seems apt 2024-05-14 19:07:43 Oh, that looks like it might be interesting. 2024-05-14 19:08:32 dlowe: Yes, people seem to very much want their system to wrap them in a safe cocoon. 2024-05-14 19:09:07 And are willing to invest a large measure of their hardware's capability into the fabrication of said cocoon. 2024-05-14 20:49:13 well, it got weirder when the hardware started supporting the cocoon