00:00:00 --- log: started forth/20.12.02 01:36:38 --- join: xek joined #forth 01:46:49 --- quit: a3f (Ping timeout: 272 seconds) 02:03:52 Hmm, how to handle conflicting word names? I think VOCABULARY is used for that, but it's not clear to me how to properly namespace things. 02:48:04 --- join: dave0 joined #forth 03:16:57 --- quit: hosewiejacke (Ping timeout: 256 seconds) 03:24:59 --- join: a3f joined #forth 03:47:12 --- quit: lispmacs[work] (Ping timeout: 256 seconds) 03:59:16 --- join: hosewiejacke joined #forth 04:44:48 --- quit: kori (Quit: WeeChat 2.8) 04:45:57 I think I'll prefix conflicting names for now until I come up with a good scheme. Even though I aim for keeping word names unique, the struct fields tend to conflict (names like length or next). 05:06:35 I tend to prefer prefixing as well, I am using Forth Standard wordspaces right now in order to write a ported forth environment 05:07:25 Wordspaces are cumbersome but solve the problem here, which is I want to write forth words mostly the same way they are written in native forth 05:07:53 Therefore I need lots of words with the same names as forth words that might do fundamentally different things 05:08:53 If you want to provide a forth package that has words that you expect might collide, then maybe the right thing to do there is put them in a wordlist. 05:09:32 Then I believe it is also relatively simple to provide a word in the default wordlist to 'export' everything in that wordlist to the current wordlist, if there are no collisions, for ease of use 05:10:00 as there are words that let you enumerate all the definitions in a wordlist 05:16:37 vocabularies are also appropriate, and I think it might be in the draft standard, not sure if that proposal was accepted, it would match what's in gforth. 05:17:24 neuro_sys: The best thing for you to do is post some example or more detail about the problem, because Forth rarely has good 'general' rules for how to actually write words 05:18:24 Forth characteristically is not good at general-purpose code, you tend to get better forth code when you actually optimise straight to solving your problem 05:18:34 There are patterns but with e.g. vocabularies there is no one answer 05:47:59 --- quit: hosewiejacke (Ping timeout: 264 seconds) 05:52:15 veltas: Here's one example where I used prefix to designate "private" words: https://gist.github.com/neuro-sys/85596069faf43469b665c0e5ba413c0d 05:59:20 neuro_sys: I think to know whether this is appropriate I would need to see how your list words are being used 05:59:30 --- join: hosewiejacke joined #forth 06:00:00 But it seems like a mostly reasonable choice of naming 06:02:38 --- quit: actuallybatman (Ping timeout: 256 seconds) 06:02:50 I can share the other two files where they're used. But basically I use anything that's not prefixed with list: from outside. This works just fine, except making the words a bit lengthier looking, so I'm good with it for now (just like in C). 06:09:21 (Nevermind the public/private BS, everything is prefixed :D) 06:15:10 Now I'd like to parse a formatted string, I think for numbers I'll have to use >NUMBER. Previously I got away with EVALUATE. 06:32:17 --- quit: dave0 (Quit: dave's not here) 06:54:46 --- quit: Zarutian_HTC (Remote host closed the connection) 06:57:42 for anyone interested, my solutions for the first two days of advent of code: http://forth.works/examples/advent-of-code-2020-day-1.retro.html http://forth.works/examples/advent-of-code-2020-day-2.retro.html 06:57:58 --- quit: xek (Ping timeout: 240 seconds) 06:58:31 --- join: xek joined #forth 06:58:56 Nice I'll check later 07:01:05 crc: That looks very neat. What are [ and ]? I see that it's your dialect and has different features. 07:01:57 And { } 07:02:32 Ah just reading about them on the online book. 07:02:46 [ ] are anonymous quotations 07:02:54 { } create arrays 07:03:35 I wonder if your arrays are stored on stack or in heap (ALLOCATE) or elsewhere. 07:03:53 Or maybe they're first class citizend of your language and implemented internally. 07:04:29 "Their password database seems to be a little corrupted: some of the passwords wouldn't have been allowed by the Official Toboggan Corporate Policy that was in effect when they were chosen." their problem was storing passwords in cleartext 07:04:39 do i get a star? 07:05:04 they're stored in the memory alongside words, strings, etc 07:05:24 Hmm, your book (/retro/book.html) does't seem to mention [ ] or anonymous quotations. 07:06:13 hmm, hit http://forth.works/doc.html for the latest 07:06:29 * crc may need to update the sync script for forthworks.com 07:06:48 Oh right. Although the link to "Quotations" is failing right now. 07:06:57 or http://forth.works/retro-book.epub if you prefer an epub 07:09:36 --- quit: hosewiejacke (Ping timeout: 260 seconds) 07:09:58 fixed the link 07:10:17 Thanks 07:11:27 I wonder something similar is possible with ANS Forth. I remember seeing a :NONAME 07:11:36 Time to check 07:11:42 :noname can't be nested, generally 07:12:15 Damn 07:12:16 Forth200x standard has [: ;] iirc 07:13:50 It seems like gforth allows nesting :noname. 07:14:01 Clumsy syntax though 07:16:28 gforth should have the [: ;] (at least in the development version): https://github.com/forthy42/gforth/blob/7edecdf373f31fdb76ab09da51c8239f04040e2b/kernel/cond.fs#L416 07:27:16 I have 0.7.3 but let me try with the repository 07:29:25 --- join: actuallybatman joined #forth 07:30:57 Ah yes it works with 0.7.9 07:31:00 Nice! 07:35:12 Part of me thinks standardizations are good for mankind. 07:41:35 --- quit: gravicappa (Ping timeout: 260 seconds) 07:49:17 --- join: gravicappa joined #forth 07:53:15 neuro_sys: https://gforth.org/manual/Quotations.html 07:53:22 I don't mind the existence of standards, I just choose when to follow them and when to go my own way 07:53:42 --- quit: gravicappa (Ping timeout: 256 seconds) 07:53:55 Standards are only good if people *want* to follow them and can afford to. If people aren't using a standard it says more about the standard than the people 07:58:13 crc: The usage of IF in retro seems to differ from Forth, and I couldn't where it's mentioned in the doc you linked. I see -if and -if; in the glossary though. 07:59:38 if takes a flag and a quote (or any pointer), and runs the quote if the flag is true (-1) 08:00:19 #1 eq? [ 'Yes s:put ] if is basicall the same as 1 = IF ." Yes" THEN 08:00:27 I see, that makes sense. It's not difficult to infer that, but just wanted to point it out. 08:02:25 http://forth.works/chapters/techniques/using-combinators.html has some coverage of if 08:05:30 --- join: hosewiejacke joined #forth 08:06:34 I remember totally not understanding quotations when reading the retro docs first time 08:16:25 crc: I have a file "test" containing the string "'hello s:put" in it. When I run "retro test" it doesn't seem to print anything. What am I missing? 08:18:27 I'll take it to #retro from now on 08:22:23 See http://forth.works/chapters/general/retro-unu.html 08:25:11 I don't think there's a rule against talking about retro in here 08:26:46 Thanks 08:27:01 Sure, but it seems more "on topic" :) 08:27:21 --- quit: crest_ (Quit: https://quassel-irc.org - Chat comfortably. Anywhere.) 08:27:53 I'll try to make use of the Forth200x Quotation to implement list vector and such, and see if I can improve the code quality. 08:29:03 Still need to write the string tokenizer to do day2 08:33:53 --- join: crest joined #forth 08:45:10 Out of curiosity, what code editor do you folk use? 08:47:42 joe 08:48:33 though I try to maintain at least minimal competence in vi, emacs, and nano 08:58:38 depends on the system. on bsd, vi, nano, or hua (my own editor); on iOS, textastic; on macOS, vi or nano. On Windows I don't edit code outside of an ssh connection to one of the other systems. 09:25:51 --- quit: hosewiejacke (Quit: Leaving) 09:28:08 I was expecting to hear that you have your own editor. 09:29:07 Hmm, I wonder how can I make a word that consumes an arbitrary number of elements from the stack. I can think of only two ways: the top of the stack denotes the number of elements, or the last element is a special token (like 0 or -1). 09:47:46 I prefer to pass in the number of elements in this case 09:48:14 unless you can be certain that the other values will never include the token value 10:08:51 --- join: lispmacs[work] joined #forth 10:17:05 --- join: Zarutian_HTC joined #forth 10:24:40 --- join: gravicappa joined #forth 10:46:45 neuro_sys: What do you want to do with the stack elements? 10:50:05 --- quit: Zarutian_HTC (Remote host closed the connection) 10:52:01 I use vim, but the default syntax highlighting for forth is bad. I have my own but right now I have syntax highlighting disabled. https://github.com/Veltas/forth-vim 11:02:11 Emacs FTW 11:02:13 heh 11:04:27 I don't edit with syntax highlighting 11:08:11 How come? It's quite useful for a quite coherency check 11:08:28 If I have mismatched quotes, it highlights 11:14:51 In Forth it's basically impossible to detect e.g. quotes correctly in all cases 11:16:57 You can do a good job guessing, but it just annoys me and I end up writing my code differently to make the syntax match better, which is silly 11:21:02 siraben: personal preference. I read/review with syntax highlighting (hence my examples all being published with this), but a lot of my stuff depends on context 11:21:53 I can pull word classification, prefix data, etc. out of my live system when generating the syntax highlighting, but would need to do a lot of manual work to keep things up to date if using this in an editor 11:22:24 that's one thing i never liked about forth - ." as a word - in my own language, i just have $ and the next thing is a string - quoted and whitespace is retained, unquoted and whitespace acts as a terminator 11:22:24 crc: what kind of stuff do you do that depends on context? 11:23:05 This guy also doesn't use syntax highlighting and here's his reasoning: http://www.linusakesson.net/programming/syntaxhighlighting/ 11:23:47 I use color to distinguish between behaviors. E.g., is a word immediate? compile only? normal? a pointer to a data structure? a constant? 11:23:50 veltas: It was for a string tokenizing word that takes a counted string, and spits out an arbitrary number of counted strings (the token offsets). 11:25:38 Ah, well in Forth it makes less sense to use syntax highlighting, very useful in other languages though. 11:27:33 I don't use other languages often (apart from implementing my MISC VM in them) 11:28:10 neuro_sys: yeah I've seen that post but it tries to compare reading code to reading prose, which isn't really the same IMO, it's far easier to scan things by color 11:28:56 good example of this is the Emacs rainbow-parens package which colors matching parens the same color 11:29:08 For Lisp code, really. 11:30:07 rainbow-delimiters, rather 11:30:40 I think it's one of those things that best compared by experience. I sometimes disable syntax highlighting and it seems like it doesn't make any difference to me *in practice*. 11:31:08 Heh, I implemented highlighting based on how a word was executed in my r216-forth, https://raw.githubusercontent.com/siraben/r216-forth/master/screenshot.png 11:31:38 But I tend to agree with Linus there, when looking at the colors it gives me a sense of "I know what's going on" feeling when I actuall don't. 11:32:16 That looks nice 11:32:21 Colors are nice, after all 11:32:27 What about scanning through code? By color it's faster to scan 11:33:35 --- quit: gravicappa (Ping timeout: 264 seconds) 11:33:48 Probably better to conduct an experiment to measure the difference rather than relying on what it feels, not sure if it's worth the time though. 11:33:58 I'll disable syntax highlighting now for a while 11:34:29 Yeah. I'll keep mine on :) 12:48:05 missed the namespace convo earlier. switching word lists in and out is really handy 12:49:47 you can specify the search order of them so its no problem to have the same word in different lists since it will search the innermost namesoace first 12:50:38 you can also just disable the current wordlist instead of juggling order to access a higher level namespace 14:14:17 the_cuckoo: I like that, very TCLish 14:14:36 Although I think ." syntax fits Forth's basic model better 15:27:44 --- join: dave0 joined #forth 16:31:38 --- quit: MrMobius (Read error: Connection reset by peer) 16:33:41 --- quit: xek (Ping timeout: 260 seconds) 16:40:57 --- join: MrMobius joined #forth 17:01:52 --- quit: MrMobius (Quit: HydraIRC -> http://www.hydrairc.com <- Wibbly Wobbly IRC) 17:25:57 --- quit: dave0 (Quit: dave's not here) 18:17:10 --- join: boru` joined #forth 18:17:13 --- quit: boru (Disconnected by services) 18:17:15 --- nick: boru` -> boru 20:49:11 --- quit: sts-q (Ping timeout: 264 seconds) 20:54:59 --- join: gravicappa joined #forth 21:00:36 --- join: sts-q joined #forth 22:28:37 --- join: hosewiejacke joined #forth 22:28:38 --- join: Zarutian_HTC joined #forth 23:59:59 --- log: ended forth/20.12.02