proteusguy has quit [Ping timeout: 264 seconds]
proteusguy has joined #forth
dave0 has joined #forth
boru` has joined #forth
boru has quit [Disconnected by services]
boru` is now known as boru
ptrkriz has quit [Remote host closed the connection]
Zarutian_HTC has joined #forth
Gromboli has quit [Read error: Connection reset by peer]
dave0 has quit [Quit: dave's not here]
jedb_ has joined #forth
jedb has quit [Ping timeout: 260 seconds]
jedb__ has joined #forth
jedb_ has quit [Ping timeout: 265 seconds]
hosewiejacke has joined #forth
sts-q has quit [Ping timeout: 240 seconds]
sts-q has joined #forth
gravicappa has joined #forth
hosewiejacke has quit [Ping timeout: 261 seconds]
jedb__ is now known as jedb
hosewiejacke has joined #forth
xek has joined #forth
a3f has quit [Ping timeout: 272 seconds]
<neuro_sys> 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.
dave0 has joined #forth
hosewiejacke has quit [Ping timeout: 256 seconds]
a3f has joined #forth
lispmacs[work] has quit [Ping timeout: 256 seconds]
hosewiejacke has joined #forth
kori has quit [Quit: WeeChat 2.8]
<neuro_sys> 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).
<veltas> I tend to prefer prefixing as well, I am using Forth Standard wordspaces right now in order to write a ported forth environment
<veltas> 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
<veltas> Therefore I need lots of words with the same names as forth words that might do fundamentally different things
<veltas> 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.
<veltas> 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
<veltas> as there are words that let you enumerate all the definitions in a wordlist
<veltas> 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.
<veltas> 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
<veltas> 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
<veltas> There are patterns but with e.g. vocabularies there is no one answer
hosewiejacke has quit [Ping timeout: 264 seconds]
<neuro_sys> veltas: Here's one example where I used prefix to designate "private" words: https://gist.github.com/neuro-sys/85596069faf43469b665c0e5ba413c0d
<veltas> neuro_sys: I think to know whether this is appropriate I would need to see how your list words are being used
hosewiejacke has joined #forth
<veltas> But it seems like a mostly reasonable choice of naming
actuallybatman has quit [Ping timeout: 256 seconds]
<neuro_sys> 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).
<neuro_sys> (Nevermind the public/private BS, everything is prefixed :D)
<neuro_sys> 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.
dave0 has quit [Quit: dave's not here]
Zarutian_HTC has quit [Remote host closed the connection]
xek has quit [Ping timeout: 240 seconds]
xek has joined #forth
<neuro_sys> Nice I'll check later
<neuro_sys> crc: That looks very neat. What are [ and ]? I see that it's your dialect and has different features.
<neuro_sys> And { }
<neuro_sys> Ah just reading about them on the online book.
<crc> [ ] are anonymous quotations
<crc> { } create arrays
<neuro_sys> I wonder if your arrays are stored on stack or in heap (ALLOCATE) or elsewhere.
<neuro_sys> Or maybe they're first class citizend of your language and implemented internally.
<cmtptr> "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
<cmtptr> do i get a star?
<crc> they're stored in the memory alongside words, strings, etc
<neuro_sys> Hmm, your book (/retro/book.html) does't seem to mention [ ] or anonymous quotations.
<crc> hmm, hit http://forth.works/doc.html for the latest
* crc may need to update the sync script for forthworks.com
<neuro_sys> Oh right. Although the link to "Quotations" is failing right now.
<crc> or http://forth.works/retro-book.epub if you prefer an epub
hosewiejacke has quit [Ping timeout: 260 seconds]
<crc> fixed the link
<neuro_sys> Thanks
<neuro_sys> I wonder something similar is possible with ANS Forth. I remember seeing a :NONAME
<neuro_sys> Time to check
<crc> :noname can't be nested, generally
<neuro_sys> Damn
<crc> Forth200x standard has [: ;] iirc
<neuro_sys> It seems like gforth allows nesting :noname.
<neuro_sys> Clumsy syntax though
<crc> gforth should have the [: ;] (at least in the development version): https://github.com/forthy42/gforth/blob/7edecdf373f31fdb76ab09da51c8239f04040e2b/kernel/cond.fs#L416
<neuro_sys> I have 0.7.3 but let me try with the repository
actuallybatman has joined #forth
<neuro_sys> Ah yes it works with 0.7.9
<neuro_sys> Nice!
<neuro_sys> Part of me thinks standardizations are good for mankind.
gravicappa has quit [Ping timeout: 260 seconds]
gravicappa has joined #forth
<crc> I don't mind the existence of standards, I just choose when to follow them and when to go my own way
gravicappa has quit [Ping timeout: 256 seconds]
<veltas> 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
<neuro_sys> 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.
<crc> if takes a flag and a quote (or any pointer), and runs the quote if the flag is true (-1)
<crc> #1 eq? [ 'Yes s:put ] if is basicall the same as 1 = IF ." Yes" THEN
<neuro_sys> I see, that makes sense. It's not difficult to infer that, but just wanted to point it out.
hosewiejacke has joined #forth
<veltas> I remember totally not understanding quotations when reading the retro docs first time
<neuro_sys> 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?
<neuro_sys> I'll take it to #retro from now on
<veltas> I don't think there's a rule against talking about retro in here
<neuro_sys> Thanks
<neuro_sys> Sure, but it seems more "on topic" :)
crest_ has quit [Quit: https://quassel-irc.org - Chat comfortably. Anywhere.]
<neuro_sys> 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.
<neuro_sys> Still need to write the string tokenizer to do day2
crest has joined #forth
<neuro_sys> Out of curiosity, what code editor do you folk use?
<dzho> joe
<dzho> though I try to maintain at least minimal competence in vi, emacs, and nano
<crc> 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.
hosewiejacke has quit [Quit: Leaving]
<neuro_sys> I was expecting to hear that you have your own editor.
<neuro_sys> 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).
<crc> I prefer to pass in the number of elements in this case
<crc> unless you can be certain that the other values will never include the token value
lispmacs[work] has joined #forth
Zarutian_HTC has joined #forth
gravicappa has joined #forth
<veltas> neuro_sys: What do you want to do with the stack elements?
Zarutian_HTC has quit [Remote host closed the connection]
<veltas> 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
<siraben> Emacs FTW
<siraben> heh
<crc> I don't edit with syntax highlighting
<siraben> How come? It's quite useful for a quite coherency check
<siraben> If I have mismatched quotes, it highlights
<veltas> In Forth it's basically impossible to detect e.g. quotes correctly in all cases
<veltas> 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
<crc> 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
<crc> 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
<the_cuckoo> 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
<siraben> crc: what kind of stuff do you do that depends on context?
<neuro_sys> This guy also doesn't use syntax highlighting and here's his reasoning: http://www.linusakesson.net/programming/syntaxhighlighting/
<crc> I use color to distinguish between behaviors. E.g., is a word immediate? compile only? normal? a pointer to a data structure? a constant?
<neuro_sys> 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).
<siraben> Ah, well in Forth it makes less sense to use syntax highlighting, very useful in other languages though.
<crc> I don't use other languages often (apart from implementing my MISC VM in them)
<siraben> 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
<siraben> good example of this is the Emacs rainbow-parens package which colors matching parens the same color
<siraben> For Lisp code, really.
<siraben> rainbow-delimiters, rather
<neuro_sys> 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*.
<siraben> 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
<neuro_sys> 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.
<neuro_sys> That looks nice
<neuro_sys> Colors are nice, after all
<siraben> What about scanning through code? By color it's faster to scan
gravicappa has quit [Ping timeout: 264 seconds]
<neuro_sys> 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.
<neuro_sys> I'll disable syntax highlighting now for a while
<siraben> Yeah. I'll keep mine on :)
<MrMobius> missed the namespace convo earlier. switching word lists in and out is really handy
<MrMobius> 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
<MrMobius> you can also just disable the current wordlist instead of juggling order to access a higher level namespace
<veltas> the_cuckoo: I like that, very TCLish
<veltas> Although I think ." syntax fits Forth's basic model better
dave0 has joined #forth