00:00:00 --- log: started forth/18.12.29 00:07:46 --- quit: pierpal (Quit: Poof) 00:08:07 --- join: pierpal (~pierpal@95.239.223.85) joined #forth 00:21:00 --- quit: smokeink (Remote host closed the connection) 00:39:46 --- join: [1]MrMobius (~default@c-73-134-82-217.hsd1.va.comcast.net) joined #forth 00:41:00 --- join: [2]MrMobius (~default@c-73-134-82-217.hsd1.va.comcast.net) joined #forth 00:42:19 --- join: [3]MrMobius (~default@c-73-134-82-217.hsd1.va.comcast.net) joined #forth 00:42:30 --- quit: MrMobius (Ping timeout: 245 seconds) 00:44:41 --- quit: [1]MrMobius (Ping timeout: 272 seconds) 00:44:44 --- join: MrMobius (~default@c-73-134-82-217.hsd1.va.comcast.net) joined #forth 00:45:22 --- quit: [2]MrMobius (Ping timeout: 246 seconds) 00:47:47 --- quit: [3]MrMobius (Ping timeout: 268 seconds) 01:06:34 --- join: proteusguy (~proteus-g@49.230.15.216) joined #forth 01:06:35 --- mode: ChanServ set +v proteusguy 01:11:07 --- quit: gravicappa (Ping timeout: 250 seconds) 01:34:04 --- quit: pierpal (Read error: Connection reset by peer) 01:38:53 --- join: pierpal (~pierpal@95.239.223.85) joined #forth 01:45:38 Heck yeah, just realized I have 13K bytes after HERE to play with, and can write around 2 or 3 16K Forth programs for my operating system 01:45:59 Would not be possible to get more than 1K of space after HERE if I used TI's operating system 01:47:02 tabemann: Cool stuff. Let me know how it goes. 01:47:09 Time to implement anything to my heart's content 01:47:30 implement an x86_54 compatability layer. 01:47:36 Could do with one of those for the z80. 01:47:38 I just tried the example Forth program on Wikipedia https://en.wikipedia.org/wiki/Forth_language#A_complete_RC4_cipher_program and it works perfect 01:47:44 How many bytes does that take? 01:47:56 You mean x86-64? 01:48:06 Uh, that too. 01:48:34 Pull requests always welcome :). I'll try to implement more of the standard for now 01:48:38 Get CATCH and THROW to work 01:49:37 What do you mean by a compatibility layer? 01:50:42 Nothing, don't worry. Just making a stupid joke 01:55:59 My entire OS fits in 10861 bytes, heh. 01:57:03 Well I should focus on getting my OS to be usable outside of an emulator, there's no real terminal implemented yet but the way input is structured I can add a new input "device" 01:57:09 And everything should work fine. 01:59:26 i found this useful for fm/mod https://www.microsoft.com/en-us/research/wp-content/uploads/2016/02/divmodnote.pdf 02:03:07 --- quit: ashirase (Ping timeout: 250 seconds) 02:03:54 I still don't know if I'd consider a Forth an operating system 02:04:15 Unless you had a Forth kernel and forth userspace 02:04:25 WilhelmVonWeiner: It isn't really, imo. 02:04:39 Operating systems are bloat 02:04:58 --- join: gravicappa (~gravicapp@85.26.234.223) joined #forth 02:05:07 Operating systems aren't bloat. 02:05:58 They are so. 02:07:26 I might consider a multiprogammed, garbage-collecting Forth an OS? 02:08:30 --- join: ashirase (~ashirase@modemcable098.166-22-96.mc.videotron.ca) joined #forth 02:08:59 multitasking. 02:10:07 It's better to think of them as Forth /systems/ 02:10:24 I think an OS has to fundamentally be able to not let the user shoot themselves in the foot easily. 02:10:42 That's giving UNIX far too much credit 02:10:46 For instance it's difficult to crash TI's operating system because there's only so much you can do 02:10:59 Except if you write asm code and flash it 02:11:11 Haha, true. 02:13:58 I think the difference between a normal OS and Forth has to be the kernelspace/userspace distinction. Where in a given OS you usually interface with hardware through the kernel, and with Forth you're just in the kernel 02:14:27 Ah, right. I've been thinking of how to implement a safe/limited version of Forth 02:14:38 Or some other language, but it may be counterproductive. 02:14:56 The more layers you add the worse performance is 02:15:04 In that case I think you would write a kernel kernel in Forth 02:17:33 Userspace could be considered blocks 02:18:26 Huh looks like there's a port to interface with an MD5 device on my calculator 02:18:27 http://wikiti.brandonw.net/index.php?title=83Plus:Ports:18 02:21:45 --- quit: proteusguy (Ping timeout: 250 seconds) 02:22:13 --- quit: gravicappa (Ping timeout: 272 seconds) 02:22:36 --- quit: pierpal (Ping timeout: 250 seconds) 02:24:18 --- join: proteusguy (~proteus-g@49.230.15.216) joined #forth 02:24:18 --- mode: ChanServ set +v proteusguy 02:25:15 --- join: pierpal (~pierpal@95.239.223.85) joined #forth 02:28:45 --- quit: pierpal (Read error: Connection reset by peer) 02:29:06 --- join: pierpal (~pierpal@95.239.223.85) joined #forth 02:42:36 blocks are just memory 03:13:24 --- join: gravicappa (~gravicapp@85.26.234.223) joined #forth 03:34:51 --- join: dddddd (~dddddd@unaffiliated/dddddd) joined #forth 03:52:28 --- join: rain1 (~My_user_n@unaffiliated/rain1) joined #forth 03:52:30 --- quit: rain2 (Ping timeout: 245 seconds) 04:22:32 --- quit: proteusguy (Ping timeout: 272 seconds) 04:24:22 --- join: proteusguy (~proteus-g@49.230.15.216) joined #forth 04:24:22 --- mode: ChanServ set +v proteusguy 05:03:23 --- join: smokeink (~smokeink@42-200-116-35.static.imsbiz.com) joined #forth 05:35:30 proteusguy: verilog 05:36:17 what's the difference between COMPILE and POSTPONE? 05:36:24 i must be something important 05:40:13 --- quit: dys (Ping timeout: 250 seconds) 05:41:35 compile always compiles the following word. postpone is aware of whether the word is immediate and has different behavior 05:41:49 postpone usually does what you actually want 05:43:18 i must be daft, i think i still didn't internalize interpretation vs compilation vs execution semantics 05:43:26 like "POSTPONE IF" - what you probably wanted there wasn't to compile the immediate word IF into the target word, but actually execute IF so that it compiles a jump into the target word 05:44:59 ok let me explore this better 05:45:15 it is confusing at first and i think it's because there isn't (or at least i'm not aware of) better language to express it 05:45:36 both POSTPONE and COMPILE are only used in IMMEDIATE words or words that are called by IMMEDATE words, right? 05:46:00 they don't have to be, but yes that's where you'll generally find them most useful 05:46:06 ok 05:46:31 is their behavior the same for non-IMMEDIATE words? 05:48:30 --- join: Kumool (~Khwerz@adsl-64-237-238-189.prtc.net) joined #forth 05:48:58 when executed from a non-imm? yes 05:50:39 no, i mean when taking non-IMMEDIATE words as argument 05:51:38 COMPILE is deprecated 05:51:44 It's been replaced by POSTPONE 05:52:30 POSTPONE: "Skip leading space delimiters. Parse name delimited by a space. Find name. Append the compilation semantics of name to the current definition. An ambiguous condition exists if name is not found. " 05:53:19 In the end I think implementations should at least conform to CORE standard words, otherwise portable programs would be a nightmare, but extension words can be implementation defined 06:02:49 corecode, think of it in levels of deferred action 06:03:23 at level 3, the word is executed when the parser encounters it, even while in compile mode (IMMEDIATE words) 06:03:51 at level 2, the word is compiled into a target word when the parser encounters it 06:04:12 and at level 1, the word has been compiled and will be executed when the target word is executed 06:04:29 COMPILE parses the next word and always treats it like level 2 06:04:45 POSTPONE parses the next word and bumps it down one level 06:05:32 sorry, still don't get it 06:05:54 i should find an implementation of POSTPONE 06:06:10 hold on, let me switch to my laptop where it'll be easier for me to type examples 06:06:21 --- quit: gravicappa (Read error: Connection reset by peer) 06:07:19 --- join: gravicappa (~gravicapp@85.26.233.92) joined #forth 06:08:38 i guess the first question is: do you understand how IF works? 06:10:47 let me try to code it up to see 06:21:40 oh man, there is also ' 06:21:54 yup 06:21:58 and ['] 06:23:18 imo this is the hardest part of understanding forth - the line between interpretation and compilation has been very blurred, and a lot of the word names don't help make that any more palatable 06:26:31 https://gist.github.com/62d40cad720ae0c38362cca9ae4ed429 06:27:36 close, except you want a SWAP before ! 06:27:51 ah yes 06:28:11 also this assumes 0BRANCH wants an address and not an offset. but that's beside the point 06:28:38 but in this example, you understand that when IF is parsed, it compiles 0BRANCH into the target word 06:30:19 now what if you wanted to write a word that extends the behavior of IF? like, maybe you wanted to count the number of times IF conditions are used in your program for some reason. you might write : MY-IF COUNT @ 1+ COUNT ! IF ; 06:30:23 IMMEDIATE 06:30:29 but that doesn't work, because IF is immediate, right? 06:30:55 which means it'll try to compile 0BRANCH and push HERE and compile a 0 into the definition of MY-IF 06:31:16 and you can't use : MY-IF COUNT @ 1+ COUNT ! COMPILE IF ; IMMEDIATE 06:31:40 because that would just compile the word IF into the word being compile when you use MY-IF, which isn't what you want, either 06:32:05 you basically want to negate the IMMEDIATE off of IF, so that it executes when your MY-IF executes 06:32:36 POSTPONE is "smart" and knows how to do that when you give it an immediate word. : MY-IF COUNT @ 1+ COUNT ! POSTPONE IF ; IMMEDIATE 06:33:29 --- quit: Kumool (Ping timeout: 240 seconds) 06:35:39 --- quit: smokeink (Ping timeout: 244 seconds) 06:35:48 --- join: Kumool (~Khwerz@adsl-64-237-234-130.prtc.net) joined #forth 06:38:20 hmm 06:38:24 yea that makes sense 06:38:29 but how do i implement that 06:38:58 i compile the call to if into my-if 06:39:07 right 06:39:17 so it is literally just 06:39:41 : POSTPONE FIND , ; ? 06:39:48 IMMEDIATE ofc 06:40:02 not quite, because it has to do something different for non-immediate words 06:40:15 if the word isn't immediate, then it needs to behave like COMPILE 06:40:27 now i need to figure out what compile would do :) 06:40:39 Hmm, how do I implement things like : where I have to read forward? 06:40:56 WORD 06:41:19 or sometimes PARSE 06:43:35 hi john_cephalopoda 06:44:07 i have : : CREATE ] ;CODE doCOLON: ... END-CODE 06:44:07 06:44:47 oh yeah, i forgot CREATE parses. i did it differently in mine 06:49:28 --- join: dys (~dys@tmo-103-128.customers.d1-online.com) joined #forth 07:00:03 how? 07:02:58 Hi corecode 07:05:23 Wait, you're using the data space at HERE for the dictionary? 07:09:30 yea, where else? 07:09:49 is there a dedicated code space? 07:11:51 corecode: noticed on your gist profile that you're an Emacs user too :) 07:12:38 corecode: : POSTPONE FIND , ; ? doesn't quite cut it, you have to manipulate the pointer returned by FIND to point to the code field address 07:12:56 This is my POSTPONE 07:13:01 : POSTPONE WORD FIND >CFA , ; IMMEDIATE 07:13:44 Where WORD reads the next word in the input stream, FIND finds the dictionary entry, >CFA converts that pointer to a code field pointer (by skipping the word name and header 07:18:34 my FIND would always return the code field address 07:18:40 why would it ever return something else? 07:22:49 --- quit: Zarutian (Read error: Connection reset by peer) 07:23:06 --- join: Zarutian (~zarutian@173-133-17-89.fiber.hringdu.is) joined #forth 07:26:15 Well how do you check if a word is immediate? 07:26:36 Must be in the headers 07:27:33 aha good point 07:27:38 thanks 07:27:39 And so if you FIND the word and get its code field address it's not gonna be easy finding the length and flags byte 07:28:01 Yeah it's not really standard but this is where I think it's better not to be 07:28:07 that explains tabemann's layout with the length byte after the name 07:28:38 Right, you can change the design to be like that if you want 07:29:11 --- join: kumul (~kumool@adsl-64-237-234-130.prtc.net) joined #forth 07:29:22 But I prefer the length byte right after the link pointer so we can just stop comparing if the lengths don't match 07:30:26 I thought the usual setup was (where | denotes cell boundary): | prev word link | xt | name length&flags | name ... |, where prev word link points to the name length&flags cell of the previous word in dictionary 07:31:20 but that is with dictionaries that split name and code parts 07:31:27 It shouldn't matter as far as Forth is concerned 07:31:45 No wonder why the standard wants FIND to return a code field pointer 07:32:15 what's xt? 07:32:45 in the case I described, each dict entry points to the name of the previous to speed up comparisons iirc 07:33:09 xt stands for eXecution Token, usually just code address 07:33:54 Ah, I see. 07:34:06 I don't do it like that but it's equivalent. 07:34:20 --- join: learning_ (~learning@108.47.9.90) joined #forth 07:34:32 Of course, a linked list is a natural way to do things 07:34:43 so with xt it is an ITC? 07:34:49 --- quit: learning_ (Remote host closed the connection) 07:35:01 in FIG Forth, IIRC, the header is just | prev word link | name length&flags | name ... | code 07:35:32 Yep that's mine 07:35:35 corecode: not nescisarly, it could just be an address to control-flow-branch to 07:36:14 siraben: I even seen one where the name is bracketed by its length 07:36:36 One shouldn't rely on layout quirks if one wants to write portable code 07:36:57 Zarutian: how so? 07:37:43 re portability: well I target a version of a dual stack machine from the "Stack Machines The New Wave" book 07:38:12 siraben: prev word link | name length&flags | name ... | name length | code ... | 07:38:44 Why would you do that? 07:39:13 Interesting nonetheless 07:40:07 because given an xt which lets say just points to the code section you can decrement it by one cell, get the length, decrement further that amount and get a pointer to the name length&flag cell 07:40:58 so getting the name of the word doesnt involve looking through the whole dictionary for it 07:41:47 Cool, that makes sense 07:42:06 Makes decompiling faster 07:44:21 In my forth system i get to control what words are exposed to the user 07:44:24 saw it in a forth that can quine itself out, so to speak. (That it is, print it entire state as an macro assembler file) 07:44:53 A lot of things aren't written in forth style for speed and making it hidden 07:45:14 Well that should be easy if you can read itself 07:45:18 You can read yourself 07:45:46 So I guess that makes some sort of kernel/user space separation in my system 07:48:27 siraben: say, does the TI you are targetting have any kind of kernel/user state bit or even simplistic MemoryM(anagement|apping)Unit that gets disabled at interrupts (and where its mmio control registers can be blocked out when the MMU is active)? 07:50:12 There is some memory protection 07:50:21 Eg the first 4000h bytes 07:50:29 Can't be written to 07:50:48 I can swap out some RAM pages with flash pages 07:51:26 And there's only some flash pages (privileged) that can write to protected pets 07:51:31 Ports 07:51:46 Some of which control flash memory management 07:52:09 There's also different modes for interrupts 07:52:26 I can make it not respond to the user pressing ON for instance 07:56:33 hmm... just wondering if 'process' seperation could be done on it basically 07:57:40 There is a project that implements a Unix like OS onto it 07:57:48 With multitasking, processes and so on 07:58:26 https://knightos.org/ 07:58:40 I haven't read their code for those parts but I should 08:01:20 --- quit: nighty- (Quit: Disappears in a puff of smoke) 08:09:47 corecode> how? 08:10:01 in mine i combined : and create so there's only one word, : 08:10:32 you use : to declare a new word, and then you say what it is. like : x var ; : page 4096 const ; 08:10:52 if you want to compile stuff, you use "does" 08:11:04 : 2dup does dup dup ; 08:11:25 and higher-order words just use the word "does" again 08:12:03 : initvar does , does @ ; : z 123 initvar ; 08:14:43 zy]x[yz: Huh, doesn't 2DUP do ( a b -- a b a b )? 08:14:59 sorry, dup2 08:15:21 whatever. all of the forth words are stupid and awful 08:15:31 What would you propose instead? 08:15:49 i don't know 08:16:05 i cleaned up : and create, though! 08:18:20 i remember someone once had an example of a generic stack-shuffling word, where you could write something like #1212 and it would compile something that would do it. i'm starting to have the opinion that that's way better than dup, swap, nip, tuck, etc. 08:23:24 Hmm, not sure. 08:23:34 First off all the efficiency would probably suffer. 08:23:51 Also, how would you drop elements with that? 08:26:13 And finally this syntax stops working when you go more than 9 stack elements down because #12 could mean ( ...3 2 1 -- ...3 2 1 12 ) or ( 2 1 -- 2 1 1 2 ) 08:28:28 yeah i don't remember the exact syntax. whatever it is, it can be designed to work 08:29:13 zy]x[yz: Retro has reorder, you pass it two strings and it shuffles the stack like so. 08:29:21 maybe that's what I'm thinking of 08:29:26 i.e. 'abcd 'dbca reorder 08:29:34 would reverse the order of the top four items 08:30:31 and i don't buy that performance would suffer. at worst it would compile the words you'd write manually, anyway. at best it would actually generate machine code to do it 08:34:35 At best your stack would be 16 registers and `reorder` owuld generate an optimised sequence of register exchanges 08:34:44 16 deep, circular 08:36:08 Do computers even have got so many registers? 08:36:36 yes 08:36:39 Yeah 08:37:01 but I'm imagining a stack processor designed for it 08:37:26 unfortunately a lot of architectures don't put their registers in addressable memory, though, so they can't overlap with the stack like he's describing 08:37:30 x86 has ~7 easily usable 32-bit registers (EAX, EBX, ECX, EDX, ESI, EDI, ESP and EBP. 08:37:59 --- quit: gravicappa (Read error: Connection reset by peer) 08:38:03 amd64 doubled those 08:38:36 (also that's 8, not 7) 08:38:57 Right, 0-indexed. 08:39:44 --- join: gravicappa (~gravicapp@85.26.165.169) joined #forth 08:39:47 "It's seven! 0, 1, 2, 3, 4, 5, 6 and 7!" said the programmer :þ 08:41:35 --- join: PoppaVic (~PoppaVic@unaffiliated/poppavic) joined #forth 08:42:04 do they still have different functions or did they ever get more orthaganol? 08:42:07 (sp) 08:43:13 what, the amd64 registers? all of the classic registers retain their old usage. the new r8-r15 registers are just general purpose 08:44:19 MrMobius: All those x86 registers I mentioned are multi-purpose, except for ESP. 08:44:29 ah ok 08:44:54 well, some of them have special meaning with some instructions 08:45:08 i remember thinking wtf when i read about 8086 registers. seems like it wasnt very multi purpose back then 08:45:15 When you want to move a register to the address of ESP, like MOV [ESP], EAX, 08:45:17 ecx, esi, and edi, in particular 08:45:19 then it won't work. 08:45:27 thats what i mean 08:45:38 you cant do memory offsets and indexing type stuff with all registers? 08:45:53 what? yes you can 08:46:02 POP and PUSH will increment or decrement ESP. CALL will also use ESP. 08:46:43 can you do MOV [x],EAX where x is any register? 08:46:51 yes 08:47:02 MrMobius: It works for every register, except or ESP. 08:47:08 *for ESP 08:47:13 no, you can also use esp 08:47:32 neato 08:48:11 a simple implementation of swap is to xchg %ebx, (%esp) (where %ebx is your TOS register) 08:48:26 zy]x[yz: Huh, I can't find a way to do that. 08:48:37 http://ref.x86asm.net/geek.html#modrm_byte_32_64 08:49:15 I can "MOV ESP, EAX", but having MOV [ESP], EAX" doesn't seem to work - at least not with MOV. 08:50:13 Of course I can do "PUSH EAX", which will basically do that, directly using MOV isn't possible though - as far as I know. 08:50:43 it has to be encoded using a SIB byte 08:51:27 http://ref.x86asm.net/geek.html#sib_byte_32_64 08:51:43 yep 08:51:48 The place where it should say "ESP" says "none" 08:51:54 that's the scaled index 08:52:18 Uh, [ESP] 08:52:37 Same for the "32-bit SIB Byte" 08:52:51 ESP would be the base, the scaled index would be 100 (none) 08:53:17 and ss would be 0 of course 08:53:37 Oh, huh, looks like I have overlooked that. Thanks. 08:54:40 x86 is a pretty crazy architecture. 08:54:49 Yes 08:54:53 yeah it's complicated. it's a huge pain to write an assembler for 08:56:22 i know because i've failed twice now 08:57:13 --- quit: dave0 (Quit: dave's not here) 08:57:58 zy]x[yz, what was your assembler for? 08:59:04 --- join: rdrop-exit (~markwilli@112.201.166.158) joined #forth 09:03:01 my forth 09:03:21 i wanted it to be self-hosting 09:04:24 zy]x[yz: I am working on an assembler right now. It actually builds runnable OS images already. 09:05:28 I think the most irksome thing is that most systems require the use of goddamned Linkers. After you manage to write the code in ANY language, you get to fight with the fucking linkers. 09:06:16 PoppaVic: Heh, I also had that problem. And then I decided to just use no linker at all. 09:07:00 I just wrote a x86 compiler that creates multiboot-executables for x86. 09:07:05 https://github.com/jmf/impexus 09:07:09 Yeah, I can remember years of no-linker-at-all. 09:07:26 And all that in less than 500 lines of code. 09:08:07 (Although some parts are still missing - ADD, MUL, DIV and SUB arer not implemented yet) 09:08:37 I suppose there is a way to write the proper file-magic header for linux, but it's something I don't care to get involved in. And, my targets for this would be samd21/51 or little avr's anyway.. Linkers, sheesh 09:08:41 the LOC metric doesn't make sense because you use way too much whitespace in your definitions john_cephalopoda 09:09:14 you can't use too much whitespace, but LOC was never a valid metric anyway 09:09:26 You definitely can use too much whitespace 09:10:10 In Forth, words might be a valid metric with well-factored code 09:12:31 Heh, code metrics are often relatively useless. 09:12:52 With enough dedication you can cheat every metric. 09:12:59 Well sure 09:13:39 I can try to find patterns and pull them together into words, even when that makes the code worse readibility-wise. 09:13:41 but you get a general idea of the maintainability, simplicity, and factored-ness of well-written code 09:13:44 Well, you'd like "codespace used vs dataspace-used", possibly "word-counts", and then you get into the speeds/bottlenecks. Lines? Not so much. 09:14:28 Well, the point of my line count measure was to show that my code is relatively small for what it can do already. 09:14:41 LOC is just a barstool comment - and yer buying the next round. 09:14:49 Otoh in Forth line count depends a lot on who writes it. 09:15:17 I put a lot of whitespace and linebreaks into my code to make clear where blocks are. 09:15:20 john_cephalopoda: http://forth.org/forth_style.html 09:15:37 yes, I've seen a LOT of forth over the years that seems to embrace the C "infinite line length" mentality.. I continue to write my vertical code 09:19:05 PoppaVic: I set an 80 character line width marker in my text editor and I'm keeping my code to the left of it. 09:19:41 There are not many things more annoying that editing code in nano that is longer than the terminal width. 09:20:41 I'm happy with 64x16 09:21:25 80x25 is the resolution of VGA text mode on x86. 09:22:03 Most terminals were 80x24 09:22:16 Also I believe that gopher recommends 80 characters width max. 09:22:38 john_cephalopoda: : 4C, DUP 2C, 16 RSHIFT 2C, ; 09:24:52 john_cephalopoda: yes, I've always used something like 75 or 78 as a wrap-point.. Unlike the numpties, I can dropkick into pico or mc-editor, or joe - I use GUI editors for ease on the eyes only. 09:25:02 --- part: kumul left #forth 09:25:21 I like 72. I think that's the recommended wrap for the OpenBSD mailing lists 09:26:06 72 would work, my setting is just predicated on readability and often a WORD will end up fitting out to 75 or 78, is all 09:26:27 PoppaVic: I use geany as my main editor and nano only if I don't intend to stay there for long or if there is no X available on the box. 09:26:38 I always think that to be the anthropic principle at heart PoppaVic 09:26:46 whatever that principle is but more general 09:27:00 with forth, I always liked th 16x64 ENFORCEMENT in blockfile[s], but I tend to think of it as 16x64 ;-) 09:27:03 Does the code just fit, or did we make it just fit? 09:27:21 Yes, geany is awfully comfortable. 09:33:07 I really like the feel of coding on 64x16 09:34:04 well, like I said above: I like to think of it as 16 chars of 64 lines. (and editor that could flip like that would be nice ;-) 09:34:34 lol 09:35:08 It's similar to the restraints I like on C code - I always get argued down - but, if I can't see the entire func in an 80x24 terminal, YER WRONG. - and less is mobetta 09:36:08 I think of it as coding on an index card 09:36:12 rdrop-exit: It would be even better if the editor had two panes: code and shadow - both 16 wide ;-) 09:36:45 :-) 09:37:14 THe majority of the space should be comments, or blank.. Or multiple SIMPLE transformers/translators/transliterators - trannies ;-) 09:37:18 My code is fairly horizontal 09:37:44 yeah, I don't do Horiz for control-flow 99% of the time. 09:38:17 hey guys 09:38:26 Hey tabemann! 09:38:56 Hi tabemann :) 09:39:13 * tabemann tends to opt for 80 columns 09:39:48 john_cephalopoda: can you share some kind of assembler code you used with your WIP assembler? 09:42:05 WilhelmVonWeiner: The init.fth file contains assembler code. 09:42:07 the core of my words tend to be only a few lines, but I often have a number of lines afterwards of ELSE foobar THEN ELSE foobar THEN etc with ELSE, foobar, and THEN all on their own lines 09:42:54 WilhelmVonWeiner: The actual code is between "HERE ASSEMBLY_START !" and "HERE ASSEMBLY_END !" 09:43:29 I very rarely nest ifs, or use else 09:44:14 I can't remember the last time I used else actually 09:45:46 * tabemann normally uses IF ELSE THEN rather than IF THEN 09:46:21 really 09:47:15 That's suprising 09:48:12 why? in a lot of my code ELSE is used to clean up from the non-execution of IF 09:48:14 When I feel tempted to use ELSE I usually refactor away the temptation 09:49:12 e.g. : FOOBAR DUP 0> IF . ELSE DROP THEN ; 09:49:39 and that's a simple example 09:51:04 I could code it as : FOOBAR DUP 0> IF DUP . THEN DROP ; 09:51:14 but that only works because it's a simple example 09:53:43 looks like yer ?DUP was fubar ;-) 09:53:55 LOL 09:54:15 you think you're funny dont ya 09:54:34 well, it's better than thinking yer a WIT - and being half-right ;-) 09:55:47 the problem with ?DUP is that it doesn't work for arbitrary conditions 09:56:10 I'm actually bemused above: in every case the examples are 'sane' in that they COULD be one-liners.. Mostly, I see code where they put too much code on the one-line to follow with a mental stack-comment 09:58:03 tabemann: I disagree. ?dup is dead-simple.. zero? nope. not-zero? dup it. YMMV 09:58:50 often one-liners are more cryptic, whereas breaking things up into multiple lines give them extra structure to help wrapping one's brain around them 09:59:05 PoppaVic: that assumes your condition is 0<> 10:00:49 Yes, it does. So, your case would require yer own spin on ?DUP 10:00:59 You can use factoring to break things up 10:01:59 until you have nice one-liners 10:05:28 You're FOOBAR seems a little contrived, do you have a more realistic example? 10:05:47 my code is rarely one-lines, more like two to five-liners - however I have many two liners where the first line is just : FOOBAR ( stack -- comment ) and the second line is the code, because the stack comment and the code are two long to fit on the same line together 10:06:50 I have a lot of those too 10:07:18 john_cephalopoda: the gopher spec recommends a max of 70, leaving 10 for client to use for displaying type information, etc 10:09:04 this one isn't exactly your idea of good forth code, but here is an example of an else clause being used to clean up: 10:09:05 : (FILTER) ( a-addr1 count1 a-addr2 xt -- count2 ) 10:09:05 0 10:09:06 [: 3 PICK 0> ;] 10:09:06 [: 4 ROLL 4 ROLL FETCH-ADVANCE DUP 5 PICK HIDE-6-BELOW-2 EXECUTE 10:09:06 SHOW-6-BELOW-1 10:09:07 [: ( a2 xt c2 a1 c1 x ) 5 ROLL TUCK ! CELL+ 3 ROLL 1+ 4 ROLL SWAP ;] 10:09:09 [: DROP 4 ROLL 4 ROLL 4 ROLL ;] CHOOSE ;] WHILE-LOOP 10:09:11 ROT ROT 2DROP ROT ROT 2DROP ; 10:09:28 eek! :) 10:09:37 CHOOSE is IF ELSE THEN 10:09:51 WHILE-LOOP is BEGIN WHILE REPEAT 10:10:22 PICK and ROLL 10:10:52 so how do you keep your UP? 10:11:14 UP? 10:11:28 is there something to get the address of the pointer that HERE will dereference? 10:11:42 something like @HERE or (HERE)? 10:11:43 oh 10:12:00 in attoforth it's not user accessible 10:13:22 oh and, if you haven't figured it out [: ;] form quotations 10:14:14 --- quit: gravicappa (Ping timeout: 246 seconds) 10:14:50 I'd say that's fairly cryptic 10:15:06 HIDE-6-BELOW-2 stuffs six values below the top two values on the stack into the return stack 10:15:46 SHOW-6-BELOW-1 takes six values from the return stack and places them below the top value on the parameter stack 10:15:53 What are all these stack gymnastics trying to accomplish? 10:16:42 that there is code for doing a FILTER against an array-list (there is another word, named FILTER, which calls this and places a-addr2 before count2 for convenience's sake) 10:17:14 the reason for hiding stuff on the return stack is so that the inner xt can operate as if it could see the outside world on the parameter stack 10:18:32 also, the gymnastics are because it is advancing a pointer pointing to the source array and decrementing a source count, while also advancing a pointer pointing to the destination array and incrementing a destination count 10:19:13 You must be taking quite a performance hit from all these gymnastics, is there no simpler way to accomplish what you need? 10:20:19 the thing is that it's got to keep track of five different things at once by its very nature 10:20:58 What do you need it for? 10:21:16 I mean, sure, I could stick these values into globals or task-locals or shit, but that wouldn't be the right way to do it 10:21:52 this words? it's a library word for implementing array filtering with an xt 10:21:56 *word 10:22:26 it's inspired by filter in Haskell and many other languages 10:23:28 The cost of all this abstraction must be very high, couldn't you strip it away and solve your problem in a more direct way? 10:23:53 https://forthworks.com/share/6f890e8fe946b99250d23cf7bc62a9ce is how I do this in my Forth 10:25:12 well the person could always just use COUNT-LOOP with a single destination index on the stack and read from one array on the stack (via PICK) or in a global and write into another array on the stack (via PICK) or in a global with the provided index 10:28:14 Just using PICK or ROLL would make my brain explode :) 10:29:11 Different strokes 10:31:14 I don't know how to program in Forth without both PICK and ROLL - I can see not using PICK, but that would require using ROLL, and ROLL probably has worse performance than PICK 10:33:37 --- join: gravicappa (~gravicapp@83.149.21.200) joined #forth 10:34:13 I can't fathom a scenario where I would need either PICK or ROLL. 10:37:27 you never need to keep track of more than three values on the stack whilst looping? 10:38:25 Keep track? No 10:40:49 --- quit: gravicappa (Remote host closed the connection) 10:42:13 more than 3 shufflers and you probably need to refactor your code 10:42:30 3-deep shufflers* 10:44:26 I never have multiple data stack operators back to back, as in your "drop 4 roll 4 roll 4 roll" example 10:45:09 --- quit: Kumool (Ping timeout: 240 seconds) 10:45:17 each stack operator is followed by work 10:45:38 that's because I'm restoring the stack to its original configuration at the start of the loop 10:46:52 could anybody link me to a single page html ANS FORTH spec? 10:47:08 i keep searching in the txt, and it is a bit tedious 10:47:20 tabemann: one forth optimization trick I read was to find which stack config needed the least manipulation inside the loop. One then put words to reconfig the stack for that right before the loop. 10:47:29 --- join: Monev (~Khwerz@adsl-64-237-239-208.prtc.net) joined #forth 10:50:01 in this case, all parts of the stack are being used at different points 10:51:23 corecode: I don't remember ever seeing any copies of the html copy as a single page 10:53:16 okay, I need to go - I'll bbl 10:55:01 Take care 10:57:01 It's almost 3am, I need to crash. Keep on Forthin' guys. 10:57:25 --- quit: rdrop-exit (Quit: Lost terminal) 11:05:38 --- quit: Monev (Ping timeout: 250 seconds) 11:05:57 corecode: Why do you need it on a single page? 11:06:25 corecode: I am using the pdf personally. Searching for words in it works more or less. 11:07:50 --- join: Monev (~Khwerz@adsl-64-237-238-109.prtc.net) joined #forth 11:08:50 corecode: "see Here"": Here dp @ ; OK", "see allot". 11:09:00 (GForth) 11:09:58 --- quit: Monev (Client Quit) 11:10:12 --- join: Kumool (~Khwerz@adsl-64-237-238-109.prtc.net) joined #forth 11:10:40 shouldn't that pdf be on forth.org, right at the top? 11:11:28 https://forthworks.com/forth/standards/DPANS/DPANS.pdf 11:11:36 https://forthworks.com/forth/standards/DPANS/DPANS.txt 11:11:37 thanks 11:11:37 IMHO it should be Source Code rather than PDF. 11:11:54 Those are the copies I have in non-html format 11:12:46 so many words to implement 11:14:08 Only if you aim for ans compliance 11:15:02 well, i want to get my kernel running 11:15:06 https://forthworks.com/forth/papers/compare.pdf has lists of the core words in a few dialects 11:16:14 Modeling after eforth would be the shortest route; it needs (I believe) 31 primitives to build into a working system 11:16:22 thank you 11:18:01 --- quit: Kumool (Ping timeout: 268 seconds) 11:20:36 No problem 11:25:42 is there a eForth i can run on linux? 11:26:41 --- join: Monev (~Khwerz@adsl-64-237-236-99.prtc.net) joined #forth 11:31:19 http://chiselapp.com/user/tehologist/repository/compc/index might 11:32:35 It uses a core vm written in C, specifically to support the eforth primitives 11:32:59 --- quit: Monev (Ping timeout: 250 seconds) 11:34:38 john_cephalopoda: what's your kernel supposed to do, just let QEMU print `Booting from ROM...`? 11:38:12 WilhelmVonWeiner: it looks like it should print "impexus" on the screen 11:39:00 WilhelmVonWeiner: It writes "impexus" to the screen in the upper left corner 11:41:15 --- join: Monev (~Khwerz@adsl-64-237-236-80.prtc.net) joined #forth 11:43:42 hm, i'm having trouble marking a word as immediate in my metacompiler 11:44:04 by the time i read immediate, the assembler code has already been output 11:44:52 i need the assembler to use the final value 11:45:20 corecode: maybe IMMEDIATE cound set a bit in the word's header that indicates that the word is immediate 11:45:53 yes, but when i read that, i already have written my assembler output 11:46:00 and then the code that decides how to execute a word can check that bit 11:46:10 written to where? 11:47:06 if it's written to a file, i see the problem 11:47:26 memory, however, can be written twice easily 11:50:16 --- quit: Monev (Ping timeout: 250 seconds) 11:50:41 back 11:51:11 yea, to the file 11:51:29 now i'm writing a symbol and i set the symbol in the end of the output. ugly but works 11:52:31 --- join: Monev (~Khwerz@adsl-64-237-236-217.prtc.net) joined #forth 11:56:39 you know, there is no restriction upon where IMMEDIATE goes, as long as it is after : and before the start of the next word 11:57:49 well, it can't be immediately after :, obviously 11:58:53 --- quit: Monev (Ping timeout: 246 seconds) 12:00:53 --- join: Monev (~Khwerz@adsl-64-237-233-114.prtc.net) joined #forth 12:01:31 ah 12:01:39 yes 12:02:42 tabemann: in ans, immediate is not an immediate word, so using it before ; to make the current word as an immediate will be non standard 12:03:19 So there is a small restriction on it 12:03:33 crc: thank you for clarifying that - I had seen forths where immediate went like : FOOBAR IMMEDIATE ... 12:04:17 Jonesforth has it flagged as immediate and uses I like that. Most I've used do not. 12:05:09 corecode: you could seek back to the header in the output file, rewrite the relevant bits, then seek back to the end before continuing to write more output 12:05:26 okay, I checked and no, in affoforth IMMEDIATE is not immediate 12:05:42 ^ 12:06:47 the only problem is if you're writing code out to a pipe 12:07:16 crc: better not :) 12:07:23 Hmm, that would present a problem 12:07:28 I'd personally write all my code into a dynamically-resized buffer, and do my retroactive editing within there, and then when everything is all done write the whole buffer out 12:08:00 then you don't need to worry about whether you can seek or not 12:08:15 and it'd be faster because you wouldn't have to go through the OS except for the final write 12:09:53 --- quit: lonjil (Ping timeout: 252 seconds) 12:10:06 My kernel is in assembly language, with headers created separately from the code. It does assemble to a buffer before being written to disk, since the assembler uses multiple passes to resolve forward references. 12:14:10 --- quit: Monev (Ping timeout: 246 seconds) 12:17:46 --- join: Monev (~Khwerz@adsl-64-237-232-111.prtc.net) joined #forth 12:19:57 uh FIND will be a chore to write 12:21:50 why? 12:22:28 if you have your wordlists organized and singly-linked lists of words, and your wordlist order as an array of pointers to wordlists 12:22:53 i only have one wordlist 12:22:55 so yea 12:23:20 you simply start with the first wordlist in the order and iterate down the singly-linked list of words until you reach a word that matches, and if none match, go onto the next wordlist, until you run out of wordlists 12:23:44 rain1: https://github.com/kanaka/mal/tree/master/forth https://github.com/davazp/eulex/lisp/ 12:23:56 thanks! 12:25:17 your second link doesn't work 12:28:29 Sorry, I added the trailing slash "/". 12:28:46 * DKordic [facepalm] 12:29:20 No I forgot to add "/tree/master/". 12:33:48 --- join: lonjil (~quassel@2a02:418:6050:ed15:ed15:ed15:e741:32d6) joined #forth 12:48:24 --- join: mtsd (~mtsd@94-137-100-130.customers.ownit.se) joined #forth 12:52:22 --- quit: Monev (Ping timeout: 268 seconds) 12:54:12 --- join: Monev (~Khwerz@adsl-64-237-238-190.prtc.net) joined #forth 13:09:14 --- quit: Monev (Ping timeout: 246 seconds) 13:23:33 --- quit: tabemann (Remote host closed the connection) 13:28:35 --- join: tabemann (~tabemann@2602:30a:c0d3:1890:2cbe:8a4c:882c:be1a) joined #forth 13:45:29 --- join: Monev (~Khwerz@adsl-64-237-239-100.prtc.net) joined #forth 13:45:39 --- quit: mtsd (Quit: WeeChat 1.6) 14:01:14 oh man FIND breaks my brain 14:10:13 and i am having real trouble shuffling the stack 14:28:45 corecode: What do you want to do with stack shuffles? 14:32:01 corecode: Remember that you always got the return stack to do fun things with. : FOOBAR ( 5 4 3 2 1 0 -- 4 3 2 1 0 5 ) >R >R >R >R SWAP R> SWAP R> SWAP R> SWAP R> SWAP ; 14:49:29 john_cephalopoda: How is it better in any way than Local Variables, like "let" from Lisp?! 14:53:27 DKordic: Probably no advantage in doing it like that. 15:08:45 john_cephalopoda: that'd be a case where I'd use my reorder word: 15:08:56 :foobar (543210-432105) 'abcdef 'bcdefa reorder ; 15:11:52 can i see the implementation of reorder? 15:12:02 https://forthworks.com/share/8a82b2a91718d27689c8cbf121d69ec0 15:13:00 wow its much more concise than i expected 15:13:02 It's a quick and dirty approach. I use it *very* sparingly, but it's occasionally really useful 15:14:21 Let's me trivially (but slowly) reorder up to 26 values into any combination I want 15:20:54 --- quit: pierpal (Quit: Poof) 15:21:11 --- join: pierpal (~pierpal@95.239.223.85) joined #forth 15:23:57 --- quit: tabemann (Ping timeout: 250 seconds) 15:26:07 I really like the style of your blog and the content on it 15:28:00 Thanks :) 15:38:20 --- quit: Zarutian (Ping timeout: 245 seconds) 15:40:07 --- join: Zarutian (~zarutian@173-133-17-89.fiber.hringdu.is) joined #forth 16:18:15 --- quit: john_cephalopoda (Ping timeout: 268 seconds) 16:19:48 --- join: john_cephalopoda (~john@unaffiliated/john-cephalopoda/x-6407167) joined #forth 16:26:39 --- quit: Monev (Quit: EXIT) 16:26:52 --- join: Kumool (~Khwerz@adsl-64-237-239-100.prtc.net) joined #forth 16:30:15 --- join: tabemann (~tabemann@2602:30a:c0d3:1890:2cbe:8a4c:882c:be1a) joined #forth 16:33:57 --- join: smokeink (~smokeink@42-200-116-35.static.imsbiz.com) joined #forth 16:46:09 --- join: dave0 (~dave0@47.44-27-211.dynamic.dsl.syd.iprimus.net.au) joined #forth 16:47:57 hi 17:05:42 --- join: learning_ (~learning@rrcs-173-198-43-132.west.biz.rr.com) joined #forth 17:10:01 --- quit: learning_ (Remote host closed the connection) 17:39:32 --- quit: dys (Ping timeout: 250 seconds) 17:44:55 --- quit: nerfur (Ping timeout: 246 seconds) 17:45:45 --- join: nerfur (~nerfur@broadband-95-84-184-13.ip.moscow.rt.ru) joined #forth 17:48:48 --- join: rdrop-exit (~markwilli@112.201.166.158) joined #forth 17:53:36 hey 17:54:48 Hi tabemann 17:55:05 I'm so annoyed by this stupid bug in my code 17:55:45 the code works fine, except that attoforth won't exit properly if it executed - but if part of the code, which shouldn't do anything, is commented out, then it segfaults 17:56:25 and apparently it's segfaulting because the IO manager is getting corrupted 17:58:30 ouch 17:59:38 tabemann: hmm... where is that code that gets commented out exactly? somewhere at hardcoded addresses? 18:00:05 the code prints a number which is the length of a buffer 18:00:51 tabemann: I did not ask what it did, but where it is. 18:01:24 oh I fixed my bug anyway - it was related to my IO code not properly handling attempts to print zero length buffers of data 18:01:51 there you go. 18:03:37 cool 18:04:35 --- quit: xek_ (Ping timeout: 245 seconds) 18:34:39 --- quit: smokeink (Remote host closed the connection) 19:16:19 wow amazing to see all the real FORTH activity going on. seems like everyone is writing their own - as a forther should! ;-) unfortunately I'm in a timezone where I miss all the action. 19:18:24 regarding the forth coding styles conversation from hours ago... 19:19:54 when I'm coding in forth primitives I generally go vertical. one line will manipulate the stack picture once, then I start a new line. makes it easy for me to track my stack pic on the white board or paper I'm writing on. I actually rarely code forth on a computer until it's pretty much done then I type it all in. 19:21:29 however, since all good forth apps are really DSLs in disguise, my higher level word code reads like short phrases with each line completing one logical thought as appropriate for the problem domain. 19:22:14 never would I approach a 70 column limit under any circumstances other than extended comments (which wrap easily anyway). 19:25:42 proteusguy: Hey 19:25:49 It's 4:25 am here... :þ 19:25:55 back 19:25:58 Hi +proteusguy 19:26:06 hey proteusguy 19:26:10 11:25a here in Bali (normally I'm at GMT+7 in Bangkok) 19:26:10 11:25 am here 19:26:27 rdrop-exit, where the hell are you?!?! :-) Singapore? 19:26:35 Manila 19:26:45 GMT +8 19:26:58 no kidding... I may be doing some stuff in Cebu this year. 19:27:06 Cool 19:27:13 Afk for now :þ 19:27:21 john_cephalopoda, sweet dreams! ;-) 19:27:33 g'night cephalopod 19:28:18 * tabemann feels like he don't have the best forth style 19:28:30 huge functions with lots of stack action 19:28:33 Style is a matter of tast 19:28:38 * taste 19:29:07 tabemann, huge is not best probably... haha but crazy refactoring is a habit one eventually forms. 19:29:22 * tabemann is busy writing up documentation for expandable buffers 19:29:53 get old enough like me and your actual brain can't handle more than 4 active items on a stack anyway. that'll impact your forth style real quick... :-D 19:30:32 I get the impression that many new Forthers don't really give the Forth approach a try, they rush to write an RPN variant of their favorite language in Forth. 19:31:21 rdrop-exit, that's something everyone experienced in just one language style will do when trying a new one whether it be functional or concatenative or OO... 19:32:08 That's why Scala people are screwed if they come from a Java background because you can pretty much code Java in Scala and get none of the benefits - which they immediately do! 19:33:04 good that forth is so alien to anything else that it forces one to switch thinking (or die trying). but also is a BIG reason our community is so tiny. 19:34:15 to me the hard part is when I just need to keep track of more than three things, and I don't want to save the data anywhere (because I hate globals and there are no data structures for me to save the data into) 19:34:23 It doesn't help that people now bundle Forth with the "concatenative" language crowd 19:34:48 But I think the arrival of Peak-Moore's Law has forced people to start trying different approaches and most functional style stuff isn't made for practical use whereas forth takes the opposite tact of being almost solely "practical" with very little guiding principles/limitations that aren't self imposed by the developer. 19:34:49 I'm sure if someone added scripting capabilities to some apps forth would get a little bit bigger, it gathered some interest with that minecraft mod that person did 19:34:49 like if I have in-addr, an in-count, an out-addr, an out-count, and a transformer xt 19:35:30 rdrop-exit, hahaha I bundle forth with concatenative crowd generally. :-) what's your beef with that? you just don't like the other languages (all 3 of them!)? 19:36:13 I find them philosophically alien to the Forth mindset 19:36:46 Too much abstraction too fast rots your Forth 19:37:19 rdrop-exit, I find them complementary to forth rather than alien. Forth, like C++, is a multi-paradigm language. 19:37:36 Forth is not a language IMO 19:37:57 rdrop-exit, agree - it's a system for building DSLs whereupon you build your (tiny) app. 19:38:51 I find the mindset of concatenative languages to be very different from Forth 19:39:19 rdrop-exit, it's more "limiting" for sure. but it's a very useful style when applied to the right domains. 19:40:14 Perhaps, but I think bundling Forth with these other languages is misleading 19:40:20 forth's "problem" is that it has no limits or constraints whatsoever. devs have to impose their own or go crazy writing themselves into corners then blaming the language after they fail. 19:40:44 That's Forth strength :) 19:41:13 Forth will never be a language for the masses 19:41:37 Factoring looks easy but it's hard 19:41:41 rdrop-exit, well depending on what I'm doing I switch between functional style, concatenative, object-oriented, and now most recently, Actor model development - sometimes intermixing several in the same system. Systems like forth make this possible. 19:42:19 ok 19:42:21 rdrop-exit, yep - Charles makes that point over and over again. Hard to argue with it but that's not always a benefit. 19:42:23 Forth can be whatever one wants it to be 19:43:00 and it's small enough language that anyone can write their own to fit their needs 19:43:47 I didn't feel up to writing an R7RS-small Scheme, yet I have found writing a Forth to be pretty painless 19:44:22 I haven't a clue how to implement Scheme's `define-syntax` 19:44:25 tabemann, pretty much. :-) it can go pretty much everywhere. 19:44:39 siraben: me either 19:44:49 Exactly, Forth is very incremental because you can mix assembly and Forth code whenever it feels convenient 19:45:09 The interpretation model is simpler too, no bound variables and so on, just a stack 19:45:23 I do wonder about ANS support for local variables 19:45:37 Parsing is slightly non-trivial for Lisp expressions 19:45:40 --- quit: dave0 (Quit: dave's not here) 19:45:44 Even harder if you want to add error reporting 19:45:46 * proteusguy pretty much pretends ANS never existed... 19:45:59 tabemann: isn't that an extension? 19:46:07 IIRC it's not in the core 19:46:20 I used Forth 2012 as a general guide to go by, but do not feel bound by it at all 19:46:35 siraben: I don't think it's core either 19:46:37 It can be a misleading guide 19:46:50 rdrop-exit, +1 19:48:12 A minimally compliant ANS forth has always been far more effort and complexity than I ever needed from a forth. That's the very antithesis of forth. It's an embarrassing chapter in the history of the language. 19:48:31 How minimal is minimally compliant? 19:48:36 Just the core words? 19:48:39 I agree 19:48:51 Elimination of all unnecessary complexity is the constant theme of all good systems. 19:48:52 anything involving a committee is suspect. 19:49:21 What are some examples of words that aren't "forthy" in the core vocab? 19:49:51 invert ;-) 19:50:10 What's wrong with that word? 19:50:23 What's wrong with "not" 19:50:36 "The word NOT was originally provided in Forth as a flag operator to make control structures readable." 19:50:36 PoppaVic, remarkably the ANSI/ISO-C++ people did a remarkably good job. How that language has evolved through the committees continues to impress me. So it can be done but it has to be based on LOTS of solid real-world experience rather than targeting some premature "abstraction" for purposes of code portability. 19:50:38 okay, for some background siraben 19:50:38 Well I have NOT 19:50:42 And INVERT 19:51:00 proteusguy: well, since I loath c++, I'd have to disagree. 19:51:18 PoppaVic, hahaha well you loath C++ for the same reason many loath forth... ;-) 19:51:19 NOT in FIG Forth was 0= 19:51:29 The Scheme committee did a good job with R5RS Scheme, although IIRC there is some considerable debate about having to split the language into a "large" and "small" version in R7RS 19:51:30 NOT in Forth 83 was a bitwise not 19:51:46 I prefer the 83 NOT 19:52:01 the ANS people didn't want to choose so they chose neither 19:52:11 right 19:52:12 and instead created INVERT, which is a bitwise not 19:52:19 right 19:52:38 Is it hard to standardize Forth 19:52:45 * PoppaVic rotfls 19:52:46 personally I found myself using 0= a lot 19:52:56 the thing is do we want standardization! 19:53:03 siraben, 2+ stacks + RPN = only forth standard that matters. :-) 19:53:31 Of course you need to standarize the semantics of words like DUP, OVER, DO, LOOP, etc. 19:53:45 but how much is another question 19:54:06 Why? 19:54:10 What also makes it hard is the "ambigious conditions" that are just like unspecified behaviors 19:54:21 Well, portability? 19:54:26 Why? 19:54:38 I should be able to use CELL+ and not worry if it's equivalent to 4+ or 2+ 19:54:39 ambiguous conditions basically means that the user can't rely on the system to not summarily crash in that case 19:54:42 CM never cared. 19:54:47 CM? 19:54:53 Chuck Moore 19:54:53 Charles Moore 19:55:07 To each their own, I suppose 19:55:20 It makes code implementation-dependent 19:55:22 siraben, that's the spirit! now you understand forth! ;-) 19:55:30 Right. 19:55:39 it's funny cause it's true. 19:56:18 rdrop-exit, check your PM... 19:56:31 how? 19:56:53 where? 19:56:55 rdrop-exit, does your IRC have dialog windows? 19:57:00 I personally do tend to like to have a core of Forth that is relatively portable, so I can execute other people's code in my Forth without requiring too much modification 19:57:11 I'm using irssi 19:57:12 tabemann: same here. 19:57:34 but at the same time I like being free to do all kinds of nonstandard shit like my lambdas 19:57:37 Obviously, your forth needs a linker. problem solved. 19:57:58 rdrop-exit, dunno about irssi... if there's some way to request a chat with an individual user try that on my handle. 19:58:15 proteusguy: /query 19:58:32 like a continuous /msg 19:58:46 --- quit: rdrop-exit (Quit: Lost terminal) 19:59:19 PoppaVic, I've already got one going with him. He needs to be able to connect to mine it seems. :-) 19:59:23 --- join: rdrop-exit (~markwilli@112.201.166.158) joined #forth 19:59:37 ah.. Well, should be the same - or similar 19:59:38 lost my connection 19:59:38 rdrop-exit, try /query proteusguy 19:59:44 ok 20:00:35 PoppaVic, thanks! That worked. 20:01:04 excellent 20:01:23 I was surprised that kip had never heard of it before, either ;-P 20:11:45 I personally would support a minimal core standard for Forth, without all the ANS crap 20:11:53 like a latter-day FIG Forth 20:14:27 Where's the FIG Forth documentation these days? 20:14:57 THey had documentation? ;-P 20:15:53 what I've been able to find on FIG Forth is a bunch of very poorly scanned assembly language printouts 20:15:54 tabemann, I wouldn't be against such an idea - but I would be very circumspect. 20:16:09 FIG was exactly that - printed source code with comments. 20:16:25 well, the FIG "distro" was exactly that: poor xeroxes of asm listings 20:17:37 iirc, I think I typed it in on my Kaypro 4-64 20:17:38 how did anyone actually use them if they were always this bad? 20:18:15 well, remember: the copies you see today are further copies. 20:18:22 What is the Forth Interest Group? 20:18:24 or what was 20:19:03 PoppaVic, wow - you are an original PC forther! 20:19:28 Kaypro was Z-80 right? 20:19:32 it was the [inter]National Interest Group.. The idea was to plug forth and gain members. Unfortunately it was hard to get articles and the damned newsletter was every-other month. 20:19:57 Yeah, z80' dial 360K 5.25" floppies 20:20:01 dual 20:20:20 What's its status now? 20:20:32 it's defunct 20:20:40 FIG is stone cold dead.. There is a site or two that have all the files they left behind 20:20:49 even though there are local FIGs still in existence, such as SVFIG 20:21:29 the irony is that this channel is one of the more active freenode channels I've been in 20:21:45 It wasn't always so 20:22:03 whoever nuked Asssau or whatever needs a medal. 20:22:07 I think this is probably the most active Forth-related group on the internet 20:22:19 Reddit is pretty cold too 20:22:58 Part of the reason for the vast silence of space is... I don't think you can get 1 dozen forthers to agree for more than a few minutes 20:23:13 I don't think Forth itself will ever die, because it's insanely easy to implement and stack-based computing is ubiquitious 20:23:27 But yeah because of this flexibility people can quickly polarize 20:23:31 tabemann, this channel was pretty dead for a number of years. 20:23:42 if you've seen one forth, you've seen one forth 20:23:55 tabemann, hahaha 20:24:06 If you've seen one forth, you wonder why the OTHER forth won't compile. 20:24:52 Forth has been the only programming language I have been able to implement correctly AND make it do useful work 20:24:58 PoppaVic, he was actually a good participant for a while until he got super bitter. I tried to work with him on it and warned him many times but eventually I had to do what needed doing. Only time in my life I ever banned someone. :-( 20:25:18 My efforts to implement Scheme in C failed miserably 20:25:18 I too would like to see something like a FIG forth, but more around the core words, implementation, defined-behaviors, examples for a few popular processors, etc 20:25:53 proteusguy: yeah, I can remember joining often, and any conversation was soon stabbed to death by him. 20:26:08 ..and I say that as a C programmer that likes forth 20:26:36 scheme is a language that seems like it should be easy to implement, and people say it is easy to implement, but actually implementing a real Scheme which is useful is hard 20:26:59 Infix is always going to be a pain in the dick. 20:27:26 the problem with scheme is the hygienic macros 20:27:28 tabemann: I got into proglang implementation when I saw https://carld.github.io/2017/06/20/lisp-in-less-than-200-lines-of-c.html 20:27:53 But this Lisp is laughably incomplete 20:28:02 And the parser is incorrect too 20:28:14 I implemented a somewhat scheme-like language a long time ago in OCaml, but it was not actually a lisp, and it had no macros 20:28:28 Macros are insanely hard to do right 20:28:47 Add hygiene at its harder 20:28:49 And its 20:30:37 I'd like to see Forth used more as a teaching language 20:31:07 I have no idea why educators would think Java is appropriate for beginners 20:31:45 Or even Python, it's far too much about writing glue to chain a bunch of black-box APIs 20:31:46 because CS today is vocational, and there are a lot of jobs that use Jva 20:31:58 *Java 20:32:22 Once you know one high-level language, they're really all the same. 20:33:02 Java is a rather poor language to learn how to program in 20:33:05 Let's say we wanted to do a #forth channel FIG standard.... I'm curious - why would we want to do it and what would be the underlying goals? Thought experiment for those who think it's a good idea. 20:33:13 Very poor, I'd say 20:33:22 Not just because of its verbosity but its insistence on the OOP paradigm 20:33:29 There are no "functions" or "words", but "methods" 20:33:38 Noun-oriented programming, etc. 20:33:41 Java requires all kinds of "design patterns" to get any shit done 20:33:47 and I hate design patterns 20:33:55 Constructors and factories and nonsense 20:34:18 proteusguy: so we can write forth that will run on more than one implementation, without constraining implementations too much 20:34:25 I'm thinking of learning Smalltalk next, but its community seems even less active than Forth 20:34:56 tabemann, so your primary goal would be code portability, correct? across any #forth platform or just on the same CPU architecture? 20:35:12 Which is somewhat of a shame because it really got program runtime introspection started 20:35:53 proteusguy: across any #forth platform if one really tries, i.e. does not assume any particular cell size 20:36:08 siraben, I'd advise checking out Elm or Elixir rather than Smalltalk. Elixir more so - the Actor model is really what Smalltalk had going for it (or a facsimile thereof). 20:36:25 tabemann: 1+ for not assuming cell size 20:36:32 That's why there's CELL+ 20:36:34 a bare minimum may not have anything like dynamic memory allocation or lot 20:36:42 tabemann, as soon as you don't assume a cell size you've added massive abstractions and complexity to the implementation. 20:36:49 proteusguy: Thanks, I'll check those out. 20:37:17 siraben: not just that, but just how many bits one can stuff in a CELL 20:37:17 Might get to learn a thing or two about the leaning tower of web programming 20:37:44 like a 32 bit forth can support 32 flags in a cell whereas a 16 bit forth can only support 16 flags in a cell 20:38:12 Right. 20:38:22 proteusguy: to me the real dichotomy is 16 bit versus 32 bit and 64 bit 20:38:51 I would not expect code to port between 16 bit and 32 bit, but I would expect code to port between 32 bit and 64 bit 20:39:07 tabemann, I think you have to have different standards for different word sizes. Or at least a "core" core that is specific to that. Then you can build on top of that. 20:39:45 But I doubt you'd find much useful forth code that didn't depend on which word size you picked. 20:40:07 I would make it so that the user can write word size-independent code if they really tried, but which would not expect it 20:40:42 "really tried" is a euphemism for additional unnecessary complexity. :-) 20:41:11 well, you got the smallest unit - byte; and the cell size; and the number of bits in either. You got two's-comp (or the rare NOT!); Endian. And then about 3 or 4 threading types. 20:41:35 short of making something like a C macro part of the "core" core standard, which I doubt people would go for, you're going to be cell size architecturally dependent. 20:41:38 None of this is unusual to those that suffer autoshit. 20:42:29 hm, a Macro part of the core.. gforth tries to do macros 20:43:07 I never really saw a huge issue: quote a string; execute the string. Your big issue is the state hell 20:44:05 PoppaVic, I guess I could be convinced on macros should I see a full implementation AND the ramifications on actual useful code examples. 20:44:21 there are a number of assumptions one can make: first, the size of a cell is a power of two of the number of bytes; second, the system is two's complement; three, one can write endian-independent code by following simple programming practices; four, I would not assume any threading type, and would make it so that writing to code is treated as implementation dependent 20:44:40 proteusguy: yeah, I don't THINK in macros with forth - with C, it's kinda second-nature 20:44:44 Macros make more sense in Lisps 20:45:13 tabemann: you don't get assume. You get to come up with the One True Answer to a new FIG. 20:45:14 and macro systems used in Lisp make C's "macros" look like text replacement 20:45:37 C's macros *ARE* "text replacement" - so are everyone elses. 20:45:45 hence "macro" 20:45:51 siraben, yeah C++ templates are more like it. 20:46:38 * tabemann used a bunch of macros in attoforth to allow normal and debug modes with different performance properties 20:46:47 C macros 20:46:51 and they were ugly 20:47:07 back 20:47:10 wb 20:48:02 Oof C++ template metaprogramming is some dark magic 20:48:16 If you can deal with infamously long error messages 20:48:39 Compile-time factorial is just the beginning :D 20:49:21 compile-time programming in Forth is much simpler 20:54:14 PoppaVic: the idea is to make a relatively portable core language so that one can write forth code that targets more than one implementation if one feels like it, not to specify a single one true implementation to rule them all 20:55:02 relatively means that a 16-bit embedded forth cannot be assumed to be intercompatible with a 32-bit or 64-bit POSIX forth, for instance 20:55:58 I would break down the problem into 2 layers 20:55:59 well, then you might as well stick to FIG-forth 20:57:11 Standard VMs for 16,32, and 64-bit, then a optional cross-bitwidth layer 20:57:44 The current ANS standard is at the second layer 20:59:22 Those who value high level portability and abstraction can code for the second (cross-bitwidth) layer 21:00:17 Those who just focus their coding on a particular bitwidth, don't need the additional layer, and can have more fine-grained control 21:01:04 and of course there's stuff where we'd treat it as naturally implementation-dependent, such as threading types, lower-level IO, and multitasking 21:01:12 siraben, they've fixed the error messages in the latest C++ standards. 21:01:33 Is it in g++? 21:01:47 rdrop-exit, I'm more along the lines of your thinking about different "component" level standards. 21:02:10 siraben, I believe head of g++ has this now. I know llvm's are much improved. 21:02:52 rdrop-exit, I'd agree with doing things this way, except there are some things that which would still have to be not relied upon by the programmer, such as endianness 21:02:58 Well, I don't know C++ so I wouldn't know, hehe 21:03:08 Should I even consider learning it? 21:03:14 but it is easy to write endian-independent code 21:04:08 tabemann: HEX HERE DUP 1 CELLS ALLOT FF00 ! C@ 21:04:24 You can settle on a prticular endianess for the "standard" VM 21:04:24 siraben, well template error messages were the full explosion of the realized template and it's type munging so unless you knew how the compiler worked you could quickly get lost. C++ is even tougher to master than forth. But actually if you stick to the most modern C++ standard and ignore the C history it's far more approachable. 21:04:51 I see 21:05:05 rdrop-exit: well, the easy-out is "internet-endian".. oh, wait - I mean intel.. oh, wait ;-) 21:05:18 Forth was amazingly simple to master, just needed to get that stack think and some philosophy in mind 21:05:37 Still is, if you ignore the Standard 21:05:45 I would say before anything could be "submitted" for standardization it MUST be accompanied by working code examples. Real code is the ultimate arbitrator. No pre-mature standardization. That's part of what condemned Java. 21:05:46 Haha 21:05:59 I wonder if there's a Forth targeting the JVK 21:06:01 JVM* 21:06:08 siraben, there are a few, yes. 21:06:09 to write endian-independent code you just have to never access a byte inside a cell written to memory directly 21:06:12 There is, I forget which 21:06:18 proteusguy: agreed.. I always felt the commies should provide Exemplar Code. 21:06:19 tabemann: exactly 21:06:37 If you allocated a byte, you should only access it with C@ 21:06:45 yes 21:06:58 The ANS standard has a test suite 21:07:00 that won't fly everywhere 21:07:04 I use it too 21:07:22 but, it's the same thinking the C-commies espouse. 21:07:31 I write my own tests for the words that aren't standard 21:07:36 Portability is easy, just have a VM. 21:07:41 Test suites only show compliance with a standard. That's FAR different than how the sausage is made and the standard is implemented. 21:08:06 rdrop-exit: in a sense forth already has A VM-like abstraction 21:08:15 yes 21:08:29 Well you could look at ANS-conforming implementations like gforth 21:08:30 Portability in Forth is not about libraries 21:08:43 siraben, indeed that's what we'd actually be attempting to create a standard for. The #forth system more than the #forth language. 21:08:57 Looking at gforth will make you blind - and grow hair on yer palms 21:09:04 lol 21:09:19 siraben, if you want to submit the ANS standard as our #forth standard than gforth would be a close-to-valid submission. 21:09:43 I see. Is standardization hard for really low level systems? 21:09:44 siraben, and would also be a good reason to reject ANS standard as our #forth standard (if that wasn't obvious already)! :-) 21:09:58 hehehe 21:10:01 Because you have to deal with issues like endianness and so on at some point 21:10:02 siraben, all standards are 10x harder than anyone expected. 21:10:21 one thing we could do is eliminate byte addressing 21:10:28 and assume that characters are cell-sized 21:10:33 =8-O 21:10:39 tabemann, you wanna eliminate C, ? 21:10:43 yes! 21:10:49 Throwing out the baby with the bath water 21:10:59 goodness... 21:11:03 But then HERE 1 CELL ALLOT 1+ @ 21:11:13 it's these radicalized kids today! 21:11:26 Unless you make all addresses cell-based 21:11:32 Chuck's chips are word-addressed 21:11:41 I see. 21:11:48 tabemann, ok I want you to be the one who implements text parsing for html pages and utf-8 support as part of your no-byte-sized characters standard submission. :-) 21:11:49 siraben, of course they would be 21:11:57 And then you got the mind-twisting AVR byte/word think 21:12:26 Word-addressable works well for embedded, pain for desktop 21:12:37 just so you know, I was joking 21:13:11 but if we're going to take the suggestion seriously... 21:13:18 rdrop-exit: it's merely something to think about for the "standard core". 21:13:54 proteusguy, then we specify an endianness, and write a UTF-8 parser that turns cell-packed bytes into individual cell-sized Unicode code points 21:14:43 tabemann, so are string lengths then based on code points rather than physical size? 21:14:56 tabemann: and then your system turns a 4-byte "shit" into a 16-byte mess? Thanks. Pass. 21:15:42 PoppaVic, 4 x 8 bytes I believe so 32-byte mess for proper unicode. 21:15:56 ih, geezus 21:16:01 proteusguy: it's like 24-bit pixels - everyone stores 24-bit pixels in 32-bit bytes 21:16:02 Yeah, I remember that. 21:16:15 IIRC the standard has an internationalization extension, or did they do away with it? 21:16:35 even when there's no separate alpha channel 21:16:39 XC! etc... something like that 21:16:39 * PoppaVic cringes... and slowly backs away to a safe corner.. 21:17:17 okay, I'm stupid, I just realized something 21:17:27 one cell per code point works for 32-bit 21:17:31 So far our sole objective for the standard seems to be code portability across matching standard parameters. Is that correct? Shouldn't there be more goals for the standard? 21:17:37 one cell per code point is a bad bad idea in 64-bit 21:18:25 proteusguy: been far too long since I bothered trying to read a std... I remember thinking the forth std was particularly verbose and painful. 21:18:36 It is 21:18:42 PoppaVic, that's due to ANSI standards requirements. 21:18:54 I know - involving ANSI was idiotic. 21:18:57 proteusguy: have it be small enough to be reasonably portable but large enough to be useful 21:19:31 They're no longer involved 21:19:49 Forth 2012 I think isn't an ANSI thing 21:19:51 tabemann, that's probably too subjective an assertion to be useful - without code examples. I think a properly evolved code standard will arrive at the right tradeoff if guided by actual implementations across multiple architectures. 21:20:16 I'm quite sure 2012 is corporate driven - so again.. Not overly interested. 21:21:05 proteusguy, well yes it is subjective, and yes we need actual implementations across multiple archs before we can come up with something that really works 21:21:34 The only justification for following the standard is to share code, if the only code that can be shared is a bloated mess why bother? 21:21:38 I'm thinking that a good forth system standard would specify the standard FORTH stack-based processor - and then implementations of same on top of specific chip architectures as well as an FPGA implementation. THAT might actually be something useful that gets more forth adoption. More forth adoption should be an explicit goal of any #forth standard. 21:22:02 rdrop-exit, that is precisely the danger we have to always be on alert for. 21:22:49 Then we don't need a committee standard, a de-facto standard can emerge. 21:22:51 Remember the "3 instruction forth"? and ngaro (or however I am misspelling it?" Those sorta' things are your VM-level.. You define the essential math and stacks=words, minimal sizes... At some point you likely want the macro-sorta' functionality.. But you still want to be able to allow for native-code extension.. Much fun all over. 21:23:24 rdrop-exit, the "committee" is simply anyone willing to present/test code or work on writing the specification. 21:23:32 proteusguy: I tend to agree, except - I've never been overly worried about it's "adoption". 21:24:10 I don't feel like attempting to get more people to use Forth is a reason for standardization 21:24:22 The committee makes politically driven decisions, de-facto standards are enough. 21:24:30 PoppaVic, doesn't any supposed value of a standard ultimate distill into something derived from having more people capable of sharing more code, no? 21:25:06 but I would like it for instance for other people to be able to write Forth code that I can go and run on my Forth 21:25:25 proteusguy: Well, I argree therein - but I am more of the FIG-mindset than ANSI, FORTH,INC, MPE, etc 21:25:32 like if someone writes a crypto algorithm I'd like to take that crypto algorithm and run it with minimum modification 21:25:41 PoppaVic, I think we're agreeing actually. 21:26:26 proteusguy: I suspect so.. I just don't like to see the corporate-grab and then the never-to-forget NDA-bs that contributed to the FIG death 21:27:18 PoppaVic, when that's our problem then we win. Absolutely we product the thing under a CC license or something so it's public domain from the get go. 21:27:23 tabemann: sure, but if the crypto code is a bloated mess of compromises, you'd probably want to rewrite eventually. 21:27:28 s/product/produce/r 21:28:17 proteusguy, anything we should produce should be under a CC license for documentation and standards and MIT/BSD for code 21:28:30 rdrop-exit, for something performance sensitive like a crypto algorithm there would undoubtedly be implementations for each subset of the standard. 21:28:41 yes 21:28:42 There you go 21:29:07 I wouldn't have a subset-independent impl of something like a crypto algorithm 21:29:19 well, you start with a pseudo-code description, too - this (and at least one or 2 imps) gets you "portable" 21:29:20 --- quit: pierpal (Quit: Poof) 21:29:35 --- join: pierpal (~pierpal@95.239.223.85) joined #forth 21:29:41 but if someone else writes a 64-bit impl of a crypto algorithm for their Forth I'd like to run it on my 64-bit Forth 21:29:58 tabemann: unfortunately, you'd be wrong: because that, just like many other 'widgets' is a time-waster 21:30:49 Anyone object to the idea of the standard being targeted primarily towards a "virtual" forth processor (with variants for cell size) - and then demonstrated by implementations on selected existing processors? 21:31:28 tabemann, I think your expectation is a reasonable one for any meaningful standard. 21:31:37 iirc, one of the joys of FIG was: anything that had to run low or fast was asm - anything else was relegated to colon-defs.. Anyone was welcome to rewrite those words as prims, but FIG went that route for usability and edumacational 21:31:58 Same with eForth 21:32:36 proteusguy: the only issue I ever had with a VM was... most are slower than shit, and on small processors - or MCU's - that can get painfully slow. 21:32:38 PoppaVic, yeah I think that's probably the right approach. Of course showing that one style is better/easier to implement in ASM over another style would be strong evidence for which one to choose, IMHO. 21:32:52 ..I suspect we'd mostly be speaking of the VM as "interface" 21:32:55 EForth kinda is a de-facto Standard 21:33:02 any notion of a VM for me would have to be purely a conceptional one, not a real VM 21:33:15 Why? 21:33:19 PoppaVic, that's why I put "virtual" in quotes. I want to build this forth processor in an FPGA and see it run. Think Koopman's stack machines. 21:33:28 rdrop-exit: Yeah, that came much later and I didn't get sources I have no interest in decompiling it and guessing 21:34:15 rdrop-exit: because it would kill performance on anything embedded, which is often already crunched for processor time 21:34:20 * proteusguy isn't willing to accept a slow performing standard. 21:34:28 I've read Koopman, and I know kip has spoken of FPGA, but I have zero experience with them.. although I get the perverse feeling the Samd21/51 chips use an FPGA for the 'devices' 21:35:09 proteusguy, like I am already dissatisfied with attoforth's performance, so I can just imagine how much slower it'd be if actually executed code on a real VM 21:35:09 Yeah, I can do "slow" myself... although, I'd prolly do it in C ;-) 21:35:45 It's the only way to get true portability 21:36:33 tabemann, yeah that's not what we're talking about. We're talking about a processor whose operands are forth words. Then implementing those words in another processor asm should be fairly straightforward. 21:37:09 You define a processor, which can be implemented as a real processor, an FPGA soft processor, or a virutal processor. 21:37:13 (and you could program the VM to EMULATE the fpga) 21:38:10 If you don't pin down the processor, you'll get areas of undefined behavior. 21:38:29 Anything designed as an FPGA can eventually be made into an ASIC. Simulations in the FPGA will show what the power/performance model would be in an ultimate ASIC so you can pretty much compare FPGA implementations against each other when determining which one will ultimate be the "best" for some definition of "best". 21:38:36 I'm okay with undefined behavior, as long as those are well-defined 21:38:47 i.e. where undefine behavior is to occur 21:38:50 *undefined 21:39:40 I prefer "impdef", instead of "undef" - I always loathed the C-commies for that. 21:39:43 Your Forth doesn't have to be on this VM, just the portable code. 21:40:04 PoppaVic, there is actually a very specific difference between implementation defined and undefined. 21:40:12 I know ;-) 21:40:17 e.g. 1 HERE C! HERE @ is, as we discussed, undefined - and I am okay with that 21:40:25 PoppaVic, C has both. 21:40:58 I'll repeat myself: Your Forth doesn't have to be on this VM, just the portable 21:41:08 code. 21:41:12 proteusguy: I always felt that, instead of making the latest bells&whistles C more like c++, they should use more nails and hammer down undef for more impdef. 21:41:20 oh! oh! oh! oh! Another requirement of the standard! All forth words are LOWER CASE! :-) I've always hated forth code that yells at me! :-D 21:41:30 indeed 21:41:33 * proteusguy is waiting to be attacked on this one... 21:41:34 agreed 21:41:39 wow! joy! 21:41:42 lololol 21:42:06 Do you guys get my point? 21:42:08 the only reason to use uppercase is in - such as C - yer never gonna' see it during operation.. 21:42:10 you guys must've had fun reading my attoforth code 21:42:27 rdrop-exit, I believe so, yes. 21:42:39 rdrop-exit, but what you're essentially proposing is to have two different forth implementations side by side - a portable one, and a non-portable one 21:42:44 rdrop-exit: wherein you don't need the VM or the FPGA, just code written to be eaten by them? Yes. 21:43:22 tabemann, no I believe we're talking about a standard with explicitly defined variants. All portable for their variant parameters. 21:43:27 tabemann: you implement the VM, or you program the fpga, or.. you are lost. 21:43:46 Either side by side (FFI) or the running on top of your normal Forth. 21:43:58 PoppaVic, no you can create words in ASM that match the forth fpga code words. It will be a native forth for your processor. 21:44:19 proteusguy: yeah, you are "implementing the VM" 21:44:32 For example, I would continue to use my Forth, but when I want to run someone else's portable code, I run it on the VM. 21:44:43 rdrop-exit: yeah, I can see that. 21:44:53 PoppaVic, well it's an extremely minimal vm, so much so I doubt anyone who has ever written their own forth has done much less in terms of effort/code. 21:44:54 The earlier and lower you can implement it, the better. 21:45:06 Right 21:45:21 proteusguy: I have zero issue with what you are saying as I grok the essentials. 21:45:29 As Chuck said it should be a commuications standard. 21:45:57 the thing is that with things perspective, we're then tying down things like endianness and threading type 21:46:05 It neither poisons us by specifying actual Registers, or memory addresses, etc - nor does it leave it to magic fairy-dust 21:46:20 rdrop-exit: that sounds like CM 21:47:49 rdrop-exit, agree in as much as "Programs are meant to be read by humans and only incidentally for computers to execute" is also true. 21:48:15 That would be the best of both worlds for me, I can do my non-standard things with my Forths, when I want to run code that someone is sharing I just feed it to the VM. 21:48:55 I'm fairly sure CM was worried about "we mean this word does this.." - and he's so damned used to working alone and 10x faster than anyone else - he was off and running as they slowly muttered his words. 21:49:17 That VM could be a layer on top of my existing Forth, or a soft processor, or a library, or whatever. 21:49:30 or a C function ;-) 21:49:51 tabemann, threading type seems orthogonal to the standard to me unless I'm missing something... does it need to be a variant? endianness might be a bit more tricky as I'm not sure we can insist on requiring coding independent of it or enforcing only one. C does the independence requirement so that would be the direction I would default to but not sure how realistic it is. 21:50:41 The VM should be pinned down as much as possible, or it becomes too vague to be useful. 21:50:41 Endian is only an issue in multibyte cases, and I am sure there are a few 'words' that can clarify that. 21:51:18 Or perhaps I should say open-ended rather than vague. 21:51:25 proteusguy, to me threading type would be something we'd specify as inherently implementation dependent, and endian independence would be something that we'd assume that the programmer can write into their code 21:52:07 well the threading - you mean like ITC or STC or DTC? 21:52:12 yeah 21:52:48 I'd love to say it's impdep, but.. perhaps it's like the damned Heads that need accessors? 21:53:03 TTC, the VM is a virtual processor. 21:53:16 TTC? 21:53:23 token threading 21:53:24 Token-threaded 21:53:25 tabemann, does the threading model impact anyone other than the forth implementor in most cases? In my coding of actual applications I don't recall that being a significant consideration once I had a working forth. 21:53:30 oh, sorry 21:53:43 proteusguy, it impacts people writing low-level compiling words 21:53:53 rdrop-exit, the "VM" is a REAL processor! (just you may be using the virtual version of it) 21:54:03 Hm, yes.. a token-threaded VM would be "portable". 21:54:08 If you use TTC, you can implement it as a real processor. 21:54:35 The tokens are your opcodes. 21:55:04 tabemann: the point is the TTC is the "low-level" to the VM.. Under that...... some sorta' syscall-like interface? I dunno 21:55:25 tabemann, I would have to say low-level compiling words were implementation dependent until we had a few solid years of building real apps on top of a first version of an approved standard. 21:55:55 syscall.ioctl 21:56:11 In my scenario the VM IS the machine for protable code. 21:56:23 and portable two! 21:56:36 :-))) 21:57:04 how are we handling branches? 21:57:26 are we just putting raw addresses into the middle of the TTC code? 21:57:28 0branch? Is there anything that can't be implemented on top of it? 21:57:35 You have a 0branch opcode 21:57:36 are we making them relative? 21:57:41 rdrop-exit, I don't mean that 21:57:57 I mean how are we handling branch destinations 21:58:18 I dunno how they can be absolute on the VM side of the equation 21:58:20 You can have both, relative and absolute 21:58:21 tabemann, hmmm.... relative vs absolute - that's a tough one. 21:58:47 rdrop-exit, 0branch-abs and 0branch-rel ? 21:58:54 proteusguy: well, you could have the VM provide segment origins, I suppose 21:59:21 I don't think it's wise, but. 21:59:51 the simplest encoding would be BRANCH/0BRANCH in one cell followed by the absolute destination in the next 21:59:57 PoppaVic, I would not assume a VonNeuman maching for the processor necessarily. 22:00:00 it's just details 22:00:00 the abs & rel thing is easier on some specific-processor. 22:00:11 but if we want our code to be relocatable... 22:00:24 like if we're storing our code in an image that can be loaded from disk 22:00:25 proteusguy: yeah, I was thinking avr vs samd, etc. 22:00:58 tabemann, yeah do we relocate via the compiler or should final compiled code work anywhere? I'd assume compiler. 22:01:01 and yes, we cannot assume a von Neumann machine 22:01:31 the problem is this 22:01:50 often the available memory space in a Harvard arch is the code memory space 22:02:09 which would lend itself to native code 22:02:12 * proteusguy instinct is to try absolute branching for the initial proposed standard and see if we ever find a compelling reason to want to go the other direction. I personally prefer offset branching but modern cpus have made this less of an issue. But it should be an OPEN QUESTION for the proposed standard. 22:02:24 The VM itself can be Von Neumann 22:02:57 It also depends on the bitwidth, the wider the bitwidth the more relative is needed 22:03:36 proteusguy, absolute branching makes implementing IF ELSE THEN, BEGIN UNTIL, and BEGIN WHILE REPEAT trivial 22:03:45 * crc has only used absolute addresses in his vm designs for the last decade or so 22:03:48 rdrop-exit, yeah codesize is my biggest thought about relative branching. I'd suggest we actual measure it with real examples to see if that becomes a real concern. 22:04:40 The sole advantages to relative-only are: 1) blobs; 2) portable. 22:05:19 even with portable, it may be possible to have a code processor that ports code by changing the absolute addresses 22:05:21 looping back doesn't require an inlined address 22:05:41 nor does branhcing forward 22:05:42 like how I implemented SEE 22:05:47 or branCHING, either 22:05:48 e.g. while until loop etc... 22:06:00 where I process the code to find all the destinations 22:06:03 --- quit: pierpal (Ping timeout: 250 seconds) 22:07:23 huh 22:07:50 this of course is to make it so that SEE displays where all the branches go 22:08:06 but the same kind of functionality could be used to enable moving code 22:08:26 without requiring relative addressing 22:09:02 forward branches require an inlined destination, or a preceding lit 22:09:02 backward branches can use the return stack or an inlined destination 22:09:22 or a preceding lit 22:10:55 I'd prefer to not use the return stack for this 22:11:21 because it'd restrict the usage of >R R> across BEGIN and UNTIL 22:11:36 It's the most code-space efficient for backward branches 22:12:10 only on a 16-bit system would I consider it a worthwhile restriction just to save a cell 22:12:50 (well, some 32-bit systems as well, such as small ARM systems) 22:13:40 But these are details 22:13:40 on a 64-bit system the savings are even greater :) 22:13:48 lol 22:14:12 yes, but most 64-bit systems have ungodly amounts of memory such that 64 bits can be easily afforded 22:14:28 Cache is king 22:16:17 --- join: pierpal (~pierpal@95.239.223.85) joined #forth 22:17:33 remember, this is premature optimization 22:17:51 that's what I was saying, details 22:18:46 --- join: dave0 (~dave0@47.44-27-211.dynamic.dsl.syd.iprimus.net.au) joined #forth 22:18:48 We're just trying to agree on the main architectural principles 22:18:56 at this point 22:19:03 re 22:19:10 hey dave 22:19:18 Hi dave0 22:19:36 Gotta run, chat again later. Keep on Forthin' 22:19:46 --- quit: rdrop-exit (Quit: Lost terminal) 22:19:53 hi, bye rdrop-exit ! 22:20:07 --- join: dys (~dys@tmo-097-185.customers.d1-online.com) joined #forth 22:21:17 https://github.com/scherrey/irc-forth/wiki <-- working space - happy to add anyone who wants to join. 22:28:19 you can't standardise an irc channel! 22:28:37 you could think of that as a challenge heh 22:29:02 will it be subroutine threaded? 22:31:02 --- quit: Kumool (Quit: EXIT) 22:31:59 dave0, threading model is implementation dependent. 22:32:12 (for now) 22:32:51 meaning low level compile words are implementation dependent - could possibly be standardized to a variant but not until we see real world code justifying same. 22:33:06 proteusguy: do you prefer one or another? 22:34:43 dave0, I do not. Depends on the target processor and environment. 22:34:53 ah ok 22:35:50 --- quit: PoppaVic (Ping timeout: 264 seconds) 22:36:10 i got side tracked from Forth by looking up how fm/mod and sm/rem work 22:36:47 i wrote some very nice C code, now i have to translate it to Forth 22:37:00 fm/mod and sm/rem are surprisingly tricky 22:37:36 you missed all the excitement earlier, dave0 ! :-) but you can check out the wiki for a link to when it all started. 22:37:46 ehehehe 22:39:59 back 22:40:31 Will this standard cover I/O? 22:41:09 --- join: PoppaVic (~PoppaVic@unaffiliated/poppavic) joined #forth 22:41:14 damned laptop 22:41:17 crc, I think it needs to support some minimal I/O mechanism to be practical but probably not something people will prefer to use in most apps. 22:41:32 crc, I guess we'd need to see what's proposed. 22:42:07 perhaps some serial style I/O is required to be present then any I/O on top of that should be capable of implementing it. 22:42:13 about endianness 22:42:54 I would elect to make it arch/imp dependent, simply because making it independent would result in a significant performance hit on archs with the wrong endianness 22:43:19 I would assume just a serial terminal style IO 22:43:34 basically just KEY KEY? EMIT TYPE 22:43:59 because on many embedded systems there will be no filesystem to speak of, so we can't assume a filesystem at all 22:44:20 any IO beyond that is impl dep 22:44:30 tabemann, I think it would be useful for people to start enumerating architectural variants that we should initially target beyond the forth cpu. That might help address the endianess issue. 22:44:32 What about systems that make that more difficult? (E.g., iOS and Android, where there's not a traditional terminal environment) 22:44:45 actually, fd-mentality and stream or block-io is trivial. 22:44:47 tabemann, that's my thinking as well for I/O for now. 22:45:26 PoppaVic, I could probably easily be talked into a block-io but I'd be keeping an eye out for some minimal system that simply couldn't support it. 22:45:30 tabemann: anything embedded that speaks serial-anything would be suitable. 22:45:47 crc: then we just make those do nothing 22:45:56 proteusguy: well, yeah - it could be you ask for block, and the device is only good for serial.. 22:46:31 we could make block and fd/stream be optional features that are not part of the core standard 22:46:34 PoppaVic, how do you write to a block over serial? Need some meta addressing mechanism. So it's still got the semantics of a block, no? 22:46:54 I assume blocks on an embedded device would be in flash 22:47:03 proteusguy: well, it mostly just admits: "this is N bytes - go wild" 22:47:52 proteusguy: I just immediately think of posix file-handle stuff, and have flashbacks to cp/m ;-) 22:47:52 PoppaVic, I'd argue that's simply serial semantics. 22:48:17 PoppaVic, ok so your Kaypro is an accepted Variant target architecure is it? 22:48:25 :-) 22:48:25 lolol 22:48:41 proteusguy: gods no - sis bought that 30+ years ago - and I think they ditched it a decade later 22:48:56 well, someone could write an implementation for Z80... 22:49:04 Did someone say Z80? 22:49:09 lol 22:49:11 tabemann, haha I think someone's onto that already! 22:49:12 someone that already has a working zbo board, perhaps 22:49:31 I'm trying to add blocks soon 22:49:42 The TI-84 has flash memory that can be read/written to 22:49:52 Here's a BIG question. How many stacks??? Can we say that floating point is NOT part of the core core? 22:50:00 I'd agree 22:50:01 floating point is optional 22:50:22 FP is a whore... Anf, frankly, I often felt oddball 'types' needed their own damned stacks anyway 22:50:23 because remember we'll have embedded systems without floating point as potential targets 22:50:35 right 22:50:43 Two stacks, floats should be a separate stack, and optional 22:50:48 Floating point is necessary for calculators 22:50:48 --- quit: dddddd (Remote host closed the connection) 22:50:54 same thought here, separate targets 22:50:58 siraben: wrong 22:51:06 siraben, fixed point! 22:51:10 siraben: fixed point is an option 22:51:11 ^ 22:51:16 Ok, how would I do that? 22:51:47 The user wants to do 33.4 2.7 EXPT 22:52:15 it's called bitshifting after/before multiplications and divisions 22:52:53 https://en.wikipedia.org/wiki/Fixed-point_arithmetic 22:53:21 I would include double cells in the standard though 22:53:35 https://www.forth.com/starting-forth/5-fixed-point-arithmetic/ 22:54:03 tabemann, you'd make that argument for double cells for 64/64-bit systems? (I don't disagree) 22:54:04 as on 16-bit systems and 32-bit systems they are very useful, and while they are of less use on 64-bit systems, support for 128-bit arithmetic in gcc and clang shows it can be done 22:54:18 mecrisp includes a library of fixed point functions (gpl though) 22:55:42 proteusguy: if one needs a lot of precision, but not a huge amount, with gcc or clang one gets much better performance out of 128-bit numerics than out of arbitrary precision numerics 22:56:09 https://sourceforge.net/directory/os:linux/?q=fixed+point+math+forth 22:56:52 what about rationals? it could be a 2-cell thing 22:57:14 dave0, I LOVE rationals but don't see them as justifiable for a core core standard. 22:57:22 that's something that would be in a library 22:57:33 ah yep ok 22:57:41 So I can add something to the parser so that 123.4 4358.32 + would be accepted? 22:57:49 we're talking about core language stuff here, stuff that's gonna be baked into assembly or, failing that, C 22:58:42 siraben: well, FIG used '.' to indicate a double-number, and DPL was the number of digits to the right of it 22:58:57 siraben: 123. 4358. traditionally indicate double cells, and I know ANS specifies that they have to be 123.4e and 4358.32e etc., but I don't know if that's traditional forth or just ANS shit 22:58:59 Hm, so why fixed point and not floating point? 22:59:05 Anything that fixed point cannot do that floating point does? 22:59:30 run without a special FPU? Use integer operations? 22:59:42 siraben: because we're talking about core language stuff, and many potential targets don't support floating point in the CPU 22:59:49 iirc, it's also less "lossy" - but I am dim on that memory 22:59:50 Ah right 22:59:53 Like the z80 23:00:12 The TI operating system uses fixed point up to a certain range or precision until floating point takes over 23:01:15 if someone wants floating point on an arch without an FPU they can always use a library (I've seen a Forth library that implements floating point, which was complicated of course - we don't want to bake that kind of complicatedness into our core standard) 23:01:39 --- quit: pierpal (Ping timeout: 272 seconds) 23:04:38 coming up with an integer-standard alone will be a chore; an optional FP voc will be all kinds of beer&popcorn entertainment ;-) 23:08:41 * tabemann found writing out stuff like FSQRT FEXP FLN to be really fun... 23:09:10 writing math routines that actually work in practice, and I don't just mean in theory, is really hard 23:09:48 many functions work in theory, but either diverge, or converge far too slowly, or have far too much error in practice 23:10:15 often the taylor or maclaurin series they taught you in school just don't work right 23:10:40 I happily don't recall much of that nonsense. 23:10:58 --- join: pierpal (~pierpal@95.239.223.85) joined #forth 23:11:06 don't the vendors supply a floating-point library with their chips? 23:11:20 except it wouldn't be public domain 23:11:51 would we agree that any code we produce would have to be MIT or BSD2/3 licensed? 23:12:21 (I personally BSD3-license my code) 23:13:03 I use ISC, bu 23:13:19 but MIT or BSD are acceptable to me 23:13:55 I'd say ISC would fit as well 23:13:59 I use http://unlicense.org/ - but anything NOT friggin' GPL-anything is fine with me 23:14:27 basically, permissive licensing without any advertising clause 23:14:28 http://choosealicense.com/licenses/ 23:14:32 siraben, in floating point .1 + .2 != .3 in fixed point it does. 23:15:05 so no BSD4 23:15:20 proteusguy: right. 23:15:29 Ok so I should change how >NUMBER works? 23:15:34 siraben, that's all the reason I need to never use float. 23:16:13 I'd do public domain, but there are countries that don't allow this (e.g., Germany) 23:16:45 Not sure how I'm going to represent this on the stack, maybe ( power of base digits -- ) ? 23:16:57 crc: Huh didn't know Germany doesn't allow public doamin 23:16:59 domain 23:17:23 I posted https://github.com/scherrey/irc-forth as MIT license. Would have used a CC one but github doesn't have automated support for it so won't show the logo which is cooler. 23:17:45 siraben: it's ok, they'll have Sharia-law soon, too.. Who'da thunk? ;-P 23:17:58 Oof my Forth is GPLv3 licensed, -_- 23:18:42 siraben, in true open source, coders have rights, in GPL the code has rights instead of the developers. :-) 23:19:09 I don't read gpl'd code at all if it even remotely intersects anything I am or plan to work on 23:19:32 crc: then what do you use for comic-relief? 23:19:59 I used to go for GPL and LGPL, but I switched to BSD3 after I started coding in Haskell because the notions of "shared libraries" used by LGPL don't really work with Haskell 23:20:07 crc: Then would that mean you can't read my code :( 23:20:21 I'll open to changing it, maybe MIT 23:20:29 why read what you can't use without losing control of your own code? 23:21:34 I'm not sure that even Stallman takes such a view of the "viral" nature of the GPL 23:21:49 hahahahaha 23:22:27 i.e. that you cannot even see GPLed code without one's own code automatically being GPLed 23:22:54 Stallman's a Marxist. It makes sense to him. 23:25:09 siraben, MIT is my default license. If you need to consider specific rights and usage issues then there's probably a creative commons license that does exactly what you need. If there isn't then what you think you need probably isn't doable. https://creativecommons.org/ 23:25:20 to me in this case the reason to go with a permissive license is simply pragmatic - i.e. we are trying to get a new standard accepted, and doing anything that might prevent others from using our code to help bring that about would be counterproductive 23:26:35 e.g. for the Linux kernel the GPL v2 was the right choice, but the Linux kernel's needs are very different from our own 23:27:06 Thanks, I'll change it to MIT then 23:29:31 tabemann: true enough regarding just reading it. Easier to avoid all potential risk though. 23:30:43 crc: https://github.com/siraben/zkeme80 has been changed to MIT, perhaps you may be able to read it now ;) 23:31:04 It's much more compatible than the GPLv3 anyhow 23:32:27 siraben: I'll take a look 23:33:25 Very bare bones right now, just runs a bunch of tests and a simple use example of WORDS 23:33:45 the actual OS will have to come incrementally, I just need to think about how to lay things out. 23:33:52 Adding menus and buttons and so on 23:39:26 siraben, you're in Thailand??? 23:39:29 It's been a long time since I looked at either scheme or z8p assembly, but a quick skim looks clean and readable. 23:39:42 proteusguy: yep. 23:39:53 crc: thanks. I wrote my own assembler as well. 23:40:01 Have we ever met? I'm Ben Scherrey with Proteus Technologies. 23:40:40 No, I don't think so. Did you go to some sort of meetup? 23:41:23 Not as many as I used to but I sponsored the initial Barcamps and most recently the first Thailand PyCon. I frequent the local Python & Hackers meetup groups. 23:41:44 --- join: rdrop-exit (~markwilli@112.201.166.158) joined #forth 23:41:44 Ah I see your location on Github is also Bangkok 23:41:48 back 23:41:50 wb 23:41:54 thx 23:42:15 Cool I heard there was a Bangkok PyCon last year 23:42:51 while you were gone we were discussing licensing, and it seems the consensus is to go with permissive licenses for our code 23:43:19 along with floating point and why we shouldn't include it in the core standard 23:43:24 Thanks, I favor MIT or something similar 23:43:43 fp needn't be core I think 23:43:55 I think it should be an optional feature 23:44:10 optional ok, then not core 23:44:26 definitely not core, because many potential targets won't have FPUs 23:44:33 exactly 23:44:51 I've never bothered with FP even on CPUs that support it 23:46:33 for some reason I put FP in attoforth, largely for the challenge of writing math routines that actually worked (pssst: many of those taylor or maclaurin series you learned in school don't really work) 23:47:01 I've been meaning to read the "End of Error" 23:47:45 writing things like FLN and FEXP that actually work properly is, shall I say, hard 23:48:00 tabemann, ah... a masochist I see. No wonder it was you that proposed building a standard!! 23:48:05 https://en.wikipedia.org/wiki/Unum_(number_format) 23:48:21 half the time they diverge rather than converging, or they don't converge fast enough, or they converge but have too much error 23:50:16 Every programmer should read: http://perso.ens-lyon.fr/jean-michel.muller/goldberg.pdf 23:51:58 I kept the hardcopy on my shelf, in case I ever get tempted 23:53:12 rdrop-exit: I was reading that myself earlier today! 23:53:14 It's good. 23:53:21 Cool 23:54:01 I read parts of that 23:54:44 I haven't looked at FP since I first read it 27 years ago 23:55:27 iirc, I found it vastly depressing - then I went and added 2 2 + 23:55:32 I will take a look at Unums eventually 23:55:34 lol 23:56:22 : pi ( -- numerator denominator ) 23:56:22 $ 24baf15fe1658f99 $ bb10cb777fb8137 ; 23:56:50 $ has to be a separate word in this forth? 23:57:12 Yes, in my Forth it is, I like to keep the interpreter simple 23:57:51 SWMBO just arrived, I'll catch up later :) 23:57:55 FP to me means functional programming. Floating point isn't a thing unless I'm making graphics computations on a super-wide GPU. 23:57:58 --- quit: rdrop-exit (Quit: Lost terminal) 23:59:03 I'm used to both functional programming and floating point, so for me FP can mean either 23:59:49 I might use fixed point more, now, though, considering that now I'm aware of stuff like the perils of subtracting numbers close to one another 23:59:59 --- log: ended forth/18.12.29