2022-11-25 02:22:37 > That commentary above getes lightly into how Linux has "built in" commands and external commands. 2022-11-25 02:23:48 execline is interesting to look at; the "interpreter" parses (really just matching parentheses and unquoting; the syntax is regex-expressible afaik) a program, then execs into it 2022-11-25 02:24:53 because things that are meant to run before other things are structured as a process that takes its args, then an argv, and exec the argv at the end 2022-11-25 02:25:45 e.g. the FOO=bar echo $FOO example looks like define FOO bar echo $FOO and actually does the right thing 2022-11-25 02:25:55 the parser just splits on tokens; it doesn't know about $ 2022-11-25 02:26:21 when it execs define, define looks at ["echo", "$FOO"] and does the replacement itself in that, then execs it 2022-11-25 02:26:31 pretty clean design imo 2022-11-25 04:07:03 https://termbin.com/3ei9z look at my shiny not-so-forth code 2022-11-25 04:07:19 I think I have a name for both the browser and node versions 2022-11-25 04:07:23 bro and no 2022-11-25 04:07:24 XD 2022-11-25 04:07:38 nolang for node and bro for the browser :D 2022-11-25 04:08:06 but seems to exist yet 2022-11-25 04:08:08 https://www.nolang.com/ 2022-11-25 04:08:17 also brolang, but meh 2022-11-25 04:08:55 https://earnest-pastelito-d7a86f.netlify.app/oh.html this is what the code does btw 2022-11-25 04:09:12 not it remembers the checked button, so it's a "proper" todo app 2022-11-25 04:09:28 it's a helloworld-like app, but meh 2022-11-25 04:09:38 also needs some css as is quite ugly 2022-11-25 04:09:48 but I'm interested in making it a pwa 2022-11-25 04:21:06 https://developer.mozilla.org/en-US/docs/Web/Progressive_web_apps/Installable_PWAs 2022-11-25 04:51:32 crc: Yeah I just didn't see it in the project page or in the source code anywhere, which is not ideal. But the fact he's said it's GPL on his website elsewhere is enough 2022-11-25 04:52:29 KipIngram: The power of pipelines is the power to: redirect I/O (achievable in forth via vectorised TYPE/EXPECT), and run in parallel 2022-11-25 04:52:36 That's my take on it 2022-11-25 04:53:13 And I guess the other part of the power of pipelines is it's super easy to write and use, so a forth equivalent should be 'easy' to use 2022-11-25 04:54:00 The parallel part is achievable with forth threads, like in i.e. PolyForth 2022-11-25 04:54:15 Which doesn't even require CPU multitasking to implement, it can be entirely cooperative 2022-11-25 04:57:07 The Forth Inc feeling is that Forth is a capable shell and/or OS. I think this is true, but you might not like their editor etc. 2022-11-25 04:58:13 When you use the swiftforth demo it's quite telling, they have commands like CD and DIR built-in, it is a shell as well as a Forth environment 2022-11-25 04:59:02 On Linux version I think there's a $ word that sends the rest of the line to system() 2022-11-25 05:22:46 I wonder if anyone's written a vim-like editor in Forth 2022-11-25 05:35:54 Or a Forth-like editor in VimL? :D 2022-11-25 06:40:42 I have written a very simple screen editor that used vim-like key functionality. Block editor, t hough - not a file editor. 2022-11-25 06:41:40 What's the diff, KipIngram ? 2022-11-25 06:41:45 Forth blocks? 2022-11-25 06:43:06 Blocks in my system are 4kB disk blocks, organized as 64 64-character lines. 2022-11-25 06:43:19 So line length was not variable - I just "wsated the space." 2022-11-25 06:47:22 It didn't move data around from line to line, etc. - basically, I edited lines in place, and could cursor up and down from line to line. 2022-11-25 06:47:39 Those limitations in mind, I was fairly pleased with it. I found it to be nicely usable. 2022-11-25 06:47:59 kk sounds cool 2022-11-25 06:48:02 It could edit one or two blocks; I could hop between the two, cut and paste between them, etc. 2022-11-25 06:48:50 It would not allow me to push "non-space" data off the end of a line or the bottom of the screen. 2022-11-25 06:49:11 And it would auto-scroll up and down to keep the necessary lines visible on-screen. 2022-11-25 06:51:38 gordonjcp: I am working on a visual editor in forth in bursts, but it's meant to be "to the starting forth editor what vi is to ed" 2022-11-25 06:51:48 So sort of like a forthy vim 2022-11-25 06:52:28 KipIngram's editor sounds highly usable but I do happen to think block source code editing is retrograde 2022-11-25 06:54:02 Well, it is. 2022-11-25 06:54:58 But it works just fine, and allows for much simpler design. I regard it as philosophically in keeping with Forth's "style." 2022-11-25 06:55:09 You're not going to fill up your disk with source code - trust me. 2022-11-25 06:56:03 And I do firmly believe that since the hardware operates with some sort of fixed logical block size, there should be a facility in Forth for working with those items. 2022-11-25 06:56:45 Nothing wrong with writing a file system if you want one, but it should not be the "fundamental interface." If you go that way, you are relegating Forth to "live within an OS" status. 2022-11-25 06:56:57 Forth wants to own your system. 2022-11-25 06:57:29 Mine doesn't, of course - it runs under an OS. But I try to do as much as possible in the direction of it owning the system. 2022-11-25 06:57:31 File systems can be as simple as a tape device, so IMO not fundamentally complicated 2022-11-25 06:58:05 Sure - they don't have to be complicated. I think B-trees would make for a fairly nice one. 2022-11-25 06:58:21 We had tape devices with "file names" before tree file systems etc 2022-11-25 06:58:39 What I specifically meant there, though, also included the 64 lines of 64 chars aspect; that just tremendously simplifies the design of an editor. 2022-11-25 06:59:13 Yes. My first Forth used a TRS-80 Color Computer tape recorder interface. 2022-11-25 06:59:32 I upgraded mine to 64k and used the top 32k as a RAM disk that I loaded to and from the tape. 2022-11-25 07:00:04 Someone in here suggested using a gap buffer. It's not as simple but it seems quite simple 2022-11-25 07:00:44 Elaborate a little? 2022-11-25 07:01:10 You mean bring variable line lengths on file into a fixed line length edit buffer? 2022-11-25 07:01:19 I do think that represents a good "middle ground." 2022-11-25 07:01:46 I've given thought to doing just that this time. 2022-11-25 07:02:00 A word to expand a block into such a buffer isn't that difficult. 2022-11-25 07:03:02 Simplest way to do that would be to still use 4kB disk blocks, but let them have whatever number of lines they turned out to have. 2022-11-25 07:03:19 But if you mean something different by gap buffer, please elaborate. 2022-11-25 07:04:11 If you wanted to you could add a simple compression algorithm to that too and go even further. 2022-11-25 07:04:40 Since if you're editing it, it's source or text, and either will compress a fair bit. 2022-11-25 07:08:13 Our SSDs at work do it the other way around - fixed logical page size, compressed physical pages. That necessitates a big table, though. 2022-11-25 07:09:33 It helps that nothing is written back to the same physical location - it's re-written somewhere new each time, and the vacated region is later garbage collected. 2022-11-25 07:21:32 KipIngram: https://en.wikipedia.org/wiki/Gap_buffer 2022-11-25 07:22:44 Basically edit the whole file in one big buffer. But move the content after the insertion point to have a 'gap', to reduce shifting stuff around when inserting 2022-11-25 07:42:05 Ok, so yeah, "more or less" the same thing i was thinking of. I agree - that gives you a way to do it without a horrendous amount of complexity. 2022-11-25 07:42:16 It is more complex, but not ridiculously so. 2022-11-25 07:43:01 I probably will wind up with something like that. I've also considered an array of per line buffers of that sort. 2022-11-25 07:44:34 Also, the way my latest expect works I can edit "the whole remainder of the block" while showing only a portion of it on screen. That looks like it would work too. 2022-11-25 07:45:16 Once you have a "data length" and a "buffer length" for the line you're editing on, that becomes fairly straightforward. 2022-11-25 07:45:53 You can actually think of there being content in the part of the buffer that doesn't correspond to "this line" and thus goes undisplayed. 2022-11-25 07:46:31 But that doesn't work so well practically, because inserting a character in "this line" nudges all of the lines below. 2022-11-25 07:47:01 It's not so bad if you're using line feeds to reset the cursor to start of line, though. 2022-11-25 07:47:17 That's actually the most recent line of thought I was working on. 2022-11-25 07:48:05 I figure the amount of code any of us are going to write is so small compared to modern disk sizes that it's really kind of a non-issue. Any of these things work fine. 2022-11-25 07:49:09 Well... a lot of us keep embedded in mind 2022-11-25 07:49:30 Embedded and 8-bit computers :3 2022-11-25 07:50:04 Yeah. I'm interested in embedded too. And you're right about that. 2022-11-25 07:50:31 It kind of depends on what's most interesting to me at the moment. 2022-11-25 07:50:55 I tend to re-write this stuff over and over anyway, so I doubt the next editor I write will be my last one. 2022-11-25 07:51:39 Honestly I think the compression approach takes you the furthest down the road on that. Just completely decouple the on-storage structure from the in-buffer structure. 2022-11-25 07:52:01 Like I said - that's the very most recent thing I was working on. 2022-11-25 07:52:17 Is the plus sign plus in all languages? 2022-11-25 07:52:18 But olle asked about editors, and the fixed line length one is the one I've actually written and used. 2022-11-25 07:52:20 Like Arabic, Japanese, Hebrew 2022-11-25 07:52:22 Sorry ot 2022-11-25 07:52:38 Not ot - it's all good. 2022-11-25 07:53:01 Sorry - i don't k now the answer to that. 2022-11-25 07:53:12 It's in a lot of them, though. 2022-11-25 07:54:32 olle: Wikipedia tells me there are some Jewish schools that would use a modified symbol ﬩ 2022-11-25 07:55:04 Because the + looks a bit like a Christian symbol 2022-11-25 07:55:30 Interesting. 2022-11-25 07:56:39 There's some history section info suggesting the symbol is from maybe around the 14th century https://en.wikipedia.org/wiki/Plus_and_minus_signs#History 2022-11-25 07:57:28 This is more a browser/localization situation 2022-11-25 07:58:35 To mean "add on a new thing" rather than "sum"? 2022-11-25 07:59:55 KipIngram: What's interesting is that if you take the Jewish symbol and put two on top of each other you get plus/minus ± 2022-11-25 08:00:25 So does that mean the Jewish C++ is C± 2022-11-25 08:00:28 :-) 2022-11-25 08:01:12 I have no idea if any Jewish schools actually use this symbol today 2022-11-25 08:05:50 hm hm 2022-11-25 08:07:31 https://docslib.org/doc/1111630/utf-8-compression-huffman-s-algorithm 2022-11-25 08:08:34 I'd actually never seen how to *derive* Gray codes before. 2022-11-25 08:35:22 gordonjcp: https://sam-falvo.github.io/kestrel/2016/03/29/vibe-2.2 is vibe, a vi-like block editor 2022-11-25 09:20:25 You know, we talked a couple of times in the past about "resetting >in" to loop over input interpretation. I'm just realizing that if my conditional recursion words had the right kind of interpret behavior they could almost run there. 2022-11-25 09:21:05 The existing method for knowing where to jump back to wouldn't port over terribly well, but if there was an explicit "mark" for that it would be fairly easy to make it go. 2022-11-25 09:22:46 I'm not terribly far from having something that could have uniform behavior between interpret and compile. 2022-11-25 09:24:51 Also, if I were willing to explicitly push IP onto the return stack, the conditional jumps could go away - conditional returns would do the job. 2022-11-25 09:25:00 Slightly less efficient, but it simplifies the language. 2022-11-25 09:26:59 Less efficient because you'd have to re-push that address every time around the loop (since the "return" which now functions as a jump would remove it). 2022-11-25 09:27:45 But that makes calls and returns my only control flow mechanisms. 2022-11-25 09:28:46 And I'd no longer need to invest in temporary labels to jump back to places other than the start of a word. 2022-11-25 10:39:32 https://www.youtube.com/watch?v=IgmDDmj3Osw 34C3 ChaosWest - Die Programmiersprache Forth 2022-11-25 10:39:35 Ja ja 2022-11-25 10:39:43 Die Forth Sprache 2022-11-25 13:02:59 Hm 2022-11-25 13:03:14 How do I make a script file test.fs exist after completion instead of entering interactive mode? 2022-11-25 13:03:19 exit* 2022-11-25 13:03:30 bye? 2022-11-25 13:03:40 yep 2022-11-25 13:32:59 Good evening! 2022-11-25 13:33:55 Hi Alex 2022-11-25 13:35:51 Except a bot I'd also add a php.net-like site over all standard words. :d If time was infinite. 2022-11-25 13:47:53 : $iter ( .. $addr char xt -- .. ) { char xt } 2022-11-25 13:47:56 what's {} here? 2022-11-25 13:48:10 local variable notation? 2022-11-25 13:48:12 But that's | ? 2022-11-25 14:25:42 Damn 2022-11-25 14:25:54 Everyone having too nice Friday evenings ^^ 2022-11-25 14:42:31 olle: In gforth do `gforth script.fs -e bye` 2022-11-25 14:43:10 { is a common name for a local variable declaring word 2022-11-25 14:43:25 The standard settled on {: because { is already used for other things 2022-11-25 14:44:16 There is also LOCALS| which specifies the names in reverse order and is in ANS Forth local extensions words 2022-11-25 14:51:06 veltas: awesome thanks 2022-11-25 15:19:45 crc: Are you still in contact with Josh? 2022-11-25 15:28:33 I mean Jason 2022-11-25 15:31:24 JSON never liked my comments 2022-11-25 16:23:12 Which Josh? 2022-11-25 16:27:19 If Josh Grams, then no; it’s been at least four years; probably a bit longer 2022-11-25 16:52:36 crc: cool :-) 2022-11-25 16:52:41 veltas: heh :-) 2022-11-25 17:01:34 crc: I mean Jason sorry 2022-11-25 17:42:50 it’s been even longer since I last contacted Jason 2022-11-25 18:34:28 SASL doesn't look too complicated.... makes me wonder why it's even required 2022-11-25 18:36:11 I mean PLAIN SASL is no more sophisticated than IRC v1 + nickserv 2022-11-25 18:37:27 SASL? the auth method? 2022-11-25 18:40:04 Yeah 2022-11-25 18:40:23 I'm prototyping stuff for a forth IRC bot 2022-11-25 18:41:18 SASL is required for my server (it's required for digital ocean droplets and loads of ranges that are associated with spam) 2022-11-25 18:45:20 veltas: and what is the bots nick? 2022-11-25 18:47:23 Zarutian_iPad: What do you think is a good name? 2022-11-25 18:47:52 the fourth_one 2022-11-25 18:51:30 I've registered 'okbot' for now 2022-11-25 19:00:22 ACTION veltir af sér okinu. 2022-11-25 21:42:21 how is metaprogramming done in a real forth? 2022-11-25 21:42:52 do you use this feature often? 2022-11-25 21:43:36 I understand a word can read from the source code and evaluate stuff, also provide whatever kind of syntax it wants, but that's all I know 2022-11-25 21:43:58 depends 2022-11-25 21:44:06 in my case I can also read from the source code, but the most common metaprogramming feature in my lang is the creation of a list 2022-11-25 21:44:40 a lot of words expect lists as code to evaluate, so I can put whatever I want into a list in order to generate code 2022-11-25 21:45:23 I think there is EVAL ( strptr strlen — ) 2022-11-25 21:45:46 Zarutian_iPad: isn't eval discouraged or a code smell in Forth like in most other langs? 2022-11-25 21:46:28 Zarutian_iPad: isn't eval discouraged or a code smell in Forth like in most other langs? 2022-11-25 21:47:05 do not know why eval is considered a code smell 2022-11-25 21:47:43 in most langs eval is mainly discouraged, specially evaluating stuff that comes from a user 2022-11-25 21:47:55 oh, I see 2022-11-25 21:48:04 also it's usually seen like a code smell, or a hotfix to something that could be done in another way 2022-11-25 21:48:48 in my lang it is expected to use eval as a way similar to a lisp macro 2022-11-25 21:49:16 but I wondered how real forth metaprogramming is 2022-11-25 21:51:20 I am unsure what you mean by metaprogramming other than via text macros, hygenic lisp macros, quasiliterals, and such 2022-11-25 21:53:47 generating code on the fly 2022-11-25 21:54:25 or whatever doing this could be provide that could be achieved in other way 2022-11-25 21:54:42 for example reflection allows a lot of stuff you can get with metaprogramming 2022-11-25 21:56:17 well, all of the forth dictionary is usually accessible in memory via @ and ! but it require that you understand the word layout 2022-11-25 21:56:33 https://www.reddit.com/r/Forth/comments/eokz3y/forth_metaprogramming/ 2022-11-25 21:56:44 sad the link posted there seems to be dead 2022-11-25 21:58:28 "real" forth metaprogramming looks like parsing words. 2022-11-25 21:58:28 oh, I see. Most code gen on the fly in Forth are just IMzmEDIATE words 2022-11-25 21:58:35 and immediate words. 2022-11-25 21:58:39 IMEADIATE 2022-11-25 21:58:45 mmm, mead. 2022-11-25 21:58:46 agh 2022-11-25 21:59:19 : 2* dup + ; inline :0 2022-11-25 21:59:20 words that execute even in compile mode 2022-11-25 21:59:56 vms14: go look up how string literal parsing works in forth. 2022-11-25 22:00:03 that's an example of "real" metaprogramming. 2022-11-25 22:00:25 I just know about next-word xD 2022-11-25 22:00:30 inline might be just setting a flag bit for 2* there 2022-11-25 22:00:41 https://forth-standard.org/standard/string/SLITERAL 2022-11-25 22:00:51 also that usually there's an inner interpreter and the outer interpreter is implemented in forth itself 2022-11-25 22:01:06 well, the interpretation vs. compilation semantics of a word matter. 2022-11-25 22:01:35 it's important to think of it less as a formal language and more as a set of commands that twiddle bits in a REPL. 2022-11-25 22:01:41 or at least an interactive environment. 2022-11-25 22:01:46 you're literally turning "compile mode" on and off. 2022-11-25 22:02:03 and depending on certain flags, controlling what gets executed or written to the central datastructure, the dictionary. 2022-11-25 22:02:19 or making another 2* word defintion that shadows the earlier one and is immediate. When this latter one is encountered itjust copies the contents of the former into the defintion being compiled 2022-11-25 22:02:45 yeah. because all word lookup goes through that dynamic dictionary, you can hotpatch code. 2022-11-25 22:04:26 I should learn more about forth, I know my lang has almost nothing to do with forth, but I think I can get a lot of cool concepts and ideas from it 2022-11-25 22:04:57 my lang is just an rpn stack based lang that reads and interprets code word by word 2022-11-25 22:05:04 parsing words just, literally, look ahead in the input stream: the interpreter jumps to a subroutine that can crawl ahead in the given input, do something, modify the interpreter state, and then jump back to the main loop. 2022-11-25 22:05:06 that's the only thing similar to forth xd 2022-11-25 22:06:09 is your language interactive. 2022-11-25 22:07:17 i.e can I spin up a REPL. 2022-11-25 22:07:59 "looking ahead in the input stream" is probably the easiest/weakest form of metaprogramming because you're just repurposing subroutines you have available to you via the REPL. 2022-11-25 22:08:05 it's being implemented in js now, so only in node :/ 2022-11-25 22:08:06 there's no structured data. 2022-11-25 22:08:25 I have to provide a way to associate a repl with a running window in the browser 2022-11-25 22:08:47 I'm having a core shared by both node and the browser, and a separate file for the stuff that differs 2022-11-25 22:09:03 in fact I don't know if the forth standard has a string literal word to handle nested/escaped quotes...? 2022-11-25 22:09:14 it was on perl before, but in js is so much faster now 2022-11-25 22:09:50 the perl implementation took 12 seconds to sum a list of the numbers from 1 to 1000000 while the js version takes 0.5 seconds xD 2022-11-25 22:10:14 also node seems able to provide tco to my recursive words 2022-11-25 22:10:50 why do you need TCO? 2022-11-25 22:11:07 don't need it, but it's cool to see that I have it for free 2022-11-25 22:11:18 how are you doing the interpretation? 2022-11-25 22:11:33 I don't even have a return stack 2022-11-25 22:12:09 the thing is I have a way to "compile" stuff, because after seeing how perl was taking 12 seconds I wanted to optimize some stuff 2022-11-25 22:12:25 is it literally "turn forth-like thing into JS and then eval it". 2022-11-25 22:12:41 the compile method just converts all words into a list of subroutines 2022-11-25 22:13:01 but node is able to perform tco to those subroutines if they have tail cail recursion 2022-11-25 22:13:26 I take it each of those "subroutines" just take a data stack as an argument. 2022-11-25 22:13:33 : some-word 1 2 3 some-word ; 2022-11-25 22:13:50 and there's no way to do any compile-time stuff. 2022-11-25 22:14:03 if you compile this word it can run forever without blowing the js call stack 2022-11-25 22:14:10 if you know js here's the code 2022-11-25 22:14:22 https://termbin.com/5jalf 2022-11-25 22:14:35 this is the 'core' shared by both node and the browser 2022-11-25 22:14:49 the function compile (word) is what does the fake compiling 2022-11-25 22:15:18 it just makes a list of subroutines, but avoids the interpreter overhead in most cases 2022-11-25 22:15:25 except for syntax sugar 2022-11-25 22:15:26 mm. 2022-11-25 22:16:25 function compile (code) * 2022-11-25 22:17:28 there's a catch, a recursive word being compiled needs to use the later definition of itself 2022-11-25 22:18:21 if (typeof(compiled[found][element]) == 'function') { return compiled[found][element];} else {return ()=>{compiled[found][element]()};} } 2022-11-25 22:18:31 the else is when the function is recursive 2022-11-25 22:19:04 so it's returning a function that will use that later definition 2022-11-25 22:19:05 xD 2022-11-25 22:19:28 still node is able to provide tco with this 2022-11-25 22:19:40 firefox does not :/ 2022-11-25 22:19:45 I wonder if chrome would 2022-11-25 22:20:07 you'll find that tail call optimization isn't exactly a priority in most forths. 2022-11-25 22:20:30 in a real forth you have the return stack, so you don't need that 2022-11-25 22:20:42 well, it's still possible to overflow a return stack. 2022-11-25 22:22:35 anyways I'm focusing on the browser side, as it's funnier 2022-11-25 22:22:56 the deal being that the dispatch/lookup/execute mechanism is such a tiny part of your execution, and data/return stacks are decoupled (no stack frames). 2022-11-25 22:24:46 here's a todo app I've made with this lang 2022-11-25 22:24:48 https://beautiful-cupcake-b4cd73.netlify.app/oh.html 2022-11-25 22:24:58 it's quite ugly, I was adding stuff for css 2022-11-25 22:25:23 https://termbin.com/lgdn7 this is the code 2022-11-25 22:25:35 still the code and the whole lang are fatpacked into that html 2022-11-25 22:31:30 I'm getting a lot of fun at least xD 2022-11-25 22:32:31 now I need to learn about pwa and I can make phone applications with this lang 2022-11-25 22:33:11 later I can add stuff to the node file, so I can do some backend stuff 2022-11-25 22:33:44 mainly I'd like to have some sort of scripting toy lang with the node version 2022-11-25 22:34:30 I know nothing about node, so there's a lot to learn