mark4 changed the topic of #forth to: Forth Programming | do drop >in | logged by clog at http://bit.ly/91toWN backup at http://forthworks.com/forth/irc-logs/ | If you have two (or more) stacks and speak RPN then you're welcome here! | https://github.com/mark4th
<mark4> wonder if i should fix this memory leak in the pulldown menus of my library lol
<mark4> wonder if i should fix this memory leak in the pulldown menus of my library lol
X-Scale` has joined #forth
X-Scale` has joined #forth
X-Scale has quit [Ping timeout: 265 seconds]
X-Scale has quit [Ping timeout: 265 seconds]
X-Scale` is now known as X-Scale
X-Scale` is now known as X-Scale
<tabemann> considering that many systems at the present far outstrip 4 GB in memory...
<tabemann> considering that many systems at the present far outstrip 4 GB in memory...
<mark4> but not one application lol
<mark4> but not one application lol
<mark4> i hope
<mark4> i hope
dave0 has joined #forth
dave0 has joined #forth
<tabemann> umm, firefox, chromium?
<tabemann> umm, firefox, chromium?
<tabemann> my web browser has a habit of making my machine lock up by making it thrash
<tabemann> my web browser has a habit of making my machine lock up by making it thrash
<KipIngram> It wouldn't surprise me - the software community seems to have no ability to restrain themselves whatsoever. They just pile new libraries on top of new frameworks and on and on and on.
<KipIngram> It wouldn't surprise me - the software community seems to have no ability to restrain themselves whatsoever. They just pile new libraries on top of new frameworks and on and on and on.
<KipIngram> A 4 GB application should be able to run your whole life.
<KipIngram> A 4 GB application should be able to run your whole life.
<KipIngram> I makes my mind reel when I think about the first IBM PC I got in '86 or so. I "splurged" to get the upgraded 30 MB hard drive, instead of the standard 20 MB.
<KipIngram> I makes my mind reel when I think about the first IBM PC I got in '86 or so. I "splurged" to get the upgraded 30 MB hard drive, instead of the standard 20 MB.
* tabemann is currently targeting much smaller platforms, though, in which a 32-bit address word is plenty
* tabemann is currently targeting much smaller platforms, though, in which a 32-bit address word is plenty
<tabemann> the board I'm currently working with has 320K RAM, 1MB internal flash, and 16MB external flash
<tabemann> the board I'm currently working with has 320K RAM, 1MB internal flash, and 16MB external flash
<tabemann> and it's considered to be "big" by embedded standards
<tabemann> and it's considered to be "big" by embedded standards
<KipIngram> I bought a little thumb drive Cortex M4 system a couple of years ago. Like 256 kB of RAM, and some flash. I had it in mind I wanted to run that last Forth on it. That was why I worked onn supporting such small page sizes, so I could multi-sessionn work on that little thing.
<KipIngram> I bought a little thumb drive Cortex M4 system a couple of years ago. Like 256 kB of RAM, and some flash. I had it in mind I wanted to run that last Forth on it. That was why I worked onn supporting such small page sizes, so I could multi-sessionn work on that little thing.
<KipIngram> Never quite got to it.
<KipIngram> Never quite got to it.
<KipIngram> Wanted to be able to fire up another "screen" in a new 4kB page.
<KipIngram> Wanted to be able to fire up another "screen" in a new 4kB page.
<KipIngram> That would just be the stuff specific to that process, of course - it would all share the same code.
<KipIngram> That would just be the stuff specific to that process, of course - it would all share the same code.
<tabemann> what I'm currently using is a Cortex-M7, even though zeptoforth also targets the Cortex-M4
<tabemann> what I'm currently using is a Cortex-M7, even though zeptoforth also targets the Cortex-M4
<tabemann> it doesn't support multiple terminals, though
<tabemann> it doesn't support multiple terminals, though
<tabemann> due to issues with compilation occurring simultaneously on different terminals
<tabemann> due to issues with compilation occurring simultaneously on different terminals
<tabemann> (when compiling to flash, what happens if two terminals try to compile code simultaneously?)
<tabemann> (when compiling to flash, what happens if two terminals try to compile code simultaneously?)
<tabemann> well
<tabemann> well
<tabemann> you could make it work with multiple terminals with some modifications
<tabemann> you could make it work with multiple terminals with some modifications
<tabemann> it just wouldn't like it if you tried to compile from both of them simultaneously
<tabemann> it just wouldn't like it if you tried to compile from both of them simultaneously
<KipIngram> Looks like my two code sections together are currently at 4390 bytes.
<KipIngram> Looks like my two code sections together are currently at 4390 bytes.
<KipIngram> That's basically with everything needed to implement that QUERY/EXPECT stuff - I made a fairly straight shot at that.
<KipIngram> That's basically with everything needed to implement that QUERY/EXPECT stuff - I made a fairly straight shot at that.
<KipIngram> Basically nothing else is implemented yet.
<KipIngram> Basically nothing else is implemented yet.
<tabemann> all in all, I did not see it as being worth it to make zeptoforth a true multiuser forth, even though it is a multitasking forth
<tabemann> all in all, I did not see it as being worth it to make zeptoforth a true multiuser forth, even though it is a multitasking forth
<tabemann> after all, it's targeting an MCU of all things
<tabemann> after all, it's targeting an MCU of all things
<tabemann> okay, time to hit the sack
<tabemann> okay, time to hit the sack
<tabemann> g'night
<tabemann> g'night
boru` has joined #forth
boru` has joined #forth
boru has quit [Disconnected by services]
boru has quit [Disconnected by services]
boru` is now known as boru
boru` is now known as boru
sts-q has quit [Ping timeout: 256 seconds]
sts-q has quit [Ping timeout: 256 seconds]
sts-q has joined #forth
sts-q has joined #forth
dave0 has quit [Quit: dave's not here]
dave0 has quit [Quit: dave's not here]
gravicappa has joined #forth
gravicappa has joined #forth
<KipIngram> I wasn't planning on multi-user either; just multi-process. I wanted the overall user interface to resemble running bash under screen.
<KipIngram> I wasn't planning on multi-user either; just multi-process. I wanted the overall user interface to resemble running bash under screen.
<KipIngram> Just be able to open new sessions and hop around among them.
<KipIngram> Just be able to open new sessions and hop around among them.
<KipIngram> Definitely no users, passwords, and that sort of thing. No particular "security" either.
<KipIngram> Definitely no users, passwords, and that sort of thing. No particular "security" either.
<KipIngram> Basically I want an environment that will just lay all of the hardware and RAM of a system out bare for me.
<KipIngram> Basically I want an environment that will just lay all of the hardware and RAM of a system out bare for me.
MrMobius has quit [Read error: No route to host]
MrMobius has quit [Read error: No route to host]
<mark4> x4 does not have user variales either
<mark4> x4 does not have user variales either
<mark4> ==758925== in use at exit: 0 bytes in 0 block
<mark4> ==758925== in use at exit: 0 bytes in 0 block
<mark4> down from 8265264956294365923765 lol
<mark4> down from 8265264956294365923765 lol
<mark4> that last one took me 3 hours to find
<mark4> that last one took me 3 hours to find
MrMobius has joined #forth
MrMobius has joined #forth
<mark4> instead of doing a win_close(win); i was doing a free on the windows buffers
<mark4> instead of doing a win_close(win); i was doing a free on the windows buffers
<mark4> leaving the window structure itself still allocaed
<mark4> leaving the window structure itself still allocaed
<mark4> duh
<mark4> duh
<KipIngram> Ah, you found it - nice!
<KipIngram> Ah, you found it - nice!
<KipIngram> That's always a satisfying feeling.
<KipIngram> That's always a satisfying feeling.
<mark4> i kind of new where all the other ones were via intuition, did not take me long to fix them
<mark4> i kind of new where all the other ones were via intuition, did not take me long to fix them
<mark4> this one hid from me lol
<mark4> this one hid from me lol
<KipIngram> Sometimes they're sneaky.
<KipIngram> Sometimes they're sneaky.
<mark4> did it to myself by calling free on an item is should have called the close function on lol
<mark4> did it to myself by calling free on an item is should have called the close function on lol
<mark4> anyway time to go into suspend state
<mark4> anyway time to go into suspend state
<KipIngram> Night.
<KipIngram> Night.
_whitelogger_ has quit [Remote host closed the connection]
_whitelogger_ has joined #forth
_whitelogger_ has joined #forth
dave0 has joined #forth
dave0 has joined #forth
Lord_Nightmare has quit [Read error: Connection reset by peer]
Lord_Nightmare has quit [Read error: Connection reset by peer]
f-a has joined #forth
f-a has joined #forth
Lord_Nightmare has joined #forth
Lord_Nightmare has joined #forth
f-a has quit [Ping timeout: 245 seconds]
f-a has quit [Ping timeout: 245 seconds]
_whitelogger_ has quit [Remote host closed the connection]
_whitelogger has joined #forth
<neuro_sys> mark4: Do you have a GUI library written in Forth?
f-a has joined #forth
<veltas> It's a TUI interface
<f-a> text user interface
<veltas> text user interface interface
hosewiejacke has joined #forth
<veltas> Is Phil Burk in here?
dddddd_ has joined #forth
<KipIngram> You'd think someone would have rolled up a curses-like library in some Forth somewhere.
<KipIngram> Someone in here a year or so ago had what sounded like a really nice display library. I'll see if I can find something in my scribblings that will help me remember who.
Zarutian_HTC has joined #forth
<KipIngram> Maybe it was rdrop-exit?
<KipIngram> I was pretty interested in it and asked some detailed questions.
<KipIngram> But whoever it was could do overlappinng windows and stuff like that.
proteus-guy has quit [Remote host closed the connection]
proteus-guy has joined #forth
dddddd_ has quit [Ping timeout: 260 seconds]
Zarutian_HTC has quit [Remote host closed the connection]
<inode> according to the links in the topic, it looks like this channel has been completely silent since 21.03.13
<f-a> weerd
<crc> inode: clog is missing
<crc> nef (who runs it) hasn't logged into bespin (the server clog runs on) since the 12th; he'll hopefully get it back soon
f-a has quit [Quit: leaving]
<crc> I'll look into exporting my personal logs for the missing time, but this may take a while to setup
tech_exorcist has joined #forth
f-a has joined #forth
<crc> I've filled in missing logs from the 12th through 7:46AM EST today, though the format is a little different (haven't taken time to write something to translate my logs to clog's format). http://forthworks.com/forth/irc-logs
<veltas> Leave it as an exercise to the reader
<inode> thanks crc
<mark4> neuro_sys: atui yes but not gui yet
hosewiejacke has quit [Ping timeout: 245 seconds]
<crc> KipIngram: rdrop-exit has a tui for his system, though I'm not sure about overlapping windows
<mark4> oh wow clog is gone!
<mark4> total heap usage: 301 allocs, 301 frees, 273,836 bytes allocated <--
<mark4> zero memory leaks yay lol
<X-Scale> what happened to clog ?
<mark4> maybe who ever owns him took him down?
<mark4> he used to be i here and a bunch of other channels lol
<X-Scale> I was checking the logs. It started logging this channel back in november 2000
<X-Scale> Also the log format changed in 2021-03-14. Maybe that was the day clog was gone.
<mark4> no idea
<crc> X-Scale: logs from 3-13 to present are from my personal records since clog disappeared on 3-12
<crc> I'll update them periodically; clog will hopefully be back
<mark4> crc you know why clog disappeared?
<crc> mark4: no
<mark4> but you saw that he had gone and thats more than i did lol
<mark4> things disappear on the internet
<X-Scale> Strangely, clog is not even registered on nickserv.
<mark4> all the time
hosewiejacke has joined #forth
<crc> my guess is that nef@bespin.org needs to restart the bot. bespin was restarted ~10 days ago, and nef hasn't logged in since the 12th
<mark4> aha
<mark4> hef owns clog :)
dave0 has quit [Quit: dave's not here]
<crc> I'm guessing it'll be back once he either checks his email and sees a report that it's down or logs into bespin again
<crc> I'll periodically fill in the missing days from my set of logs until then
<neuro_sys> mark4: Do you have any screenshots online? I'd be interested in seeing it.
<mark4> neuro_sys: screenshots of what?
<mark4> the forth tui? its in my github :)
<mark4> so is the C tui
<neuro_sys> Yes, thanks
<mark4> the forth one is a bit broken atm, not seen any love for a while but theres still some intersting stuff you can see
<mark4> the menus are totally broken atm there lol
<mark4> github.com/mark4th
<mark4> and clone the x4 rep
<mark4> make then ./extend then .x4 -f /src/examples/dots/wmdots.f
<mark4> then main
<mark4> when i get to rewriting the forth tui that demo will use progressively darker gray scals for dots that are further away
<neuro_sys> Nice it worked
<mark4> you already cloned and buit it all? lol that was fast
<neuro_sys> Yes :)
<mark4> cool
<mark4> you can make your font size smaller and the window size larger but if you pick xterms rediculously small font it breaks lol
<mark4> that wmdots is a copy of the wmdots windowmaker dockapp i wrote that does the same thing lol
<mark4> if you are a gentoo user that dockapp is in portage and i didnt put it there lol
<mark4> some gentoo dev did many many years ago
hosewiejacke has quit [Ping timeout: 245 seconds]
hosewiejacke has joined #forth
hosewiejacke has quit [Ping timeout: 245 seconds]
f-a has quit [Ping timeout: 256 seconds]
f-a has joined #forth
hosewiejacke has joined #forth
patrickg has quit [Ping timeout: 268 seconds]
patrickg has joined #forth
Zarutian_HTC has joined #forth
hosewiejacke has quit [Ping timeout: 272 seconds]
<mark4> just got back from dentists, had some tooths cleaned. they actually numb you for this too!
<mark4> now i cant drink my coffee lol
<f-a> lol do they
<f-a> not here!
<Zarutian_HTC> you can drink it, with a funnel, no?
<mark4> yea last dentist i went to did not numb for cleaning either
<mark4> this is a really good dentists, went in for a checkup and i had a problem tooth, on the day of the checkup they siad i should get my teeth cleaned and the problem tooth will need to be extracted
<Zarutian_HTC> it is the noise that bother me most. Why? because it conducts via the jawbones to the ears
<mark4> so went to pay for the checkup and schedule cleaning of first 1/4 and to get extraction
<mark4> and they had openings for both THAT DAY lol
<mark4> today was my second cleaning session and they did 2/4 so thers only one left to do
<mark4> extraction took like 15 to 20 minutes when they did it
<mark4> left side of my nose is numb lol
<mark4> after the extraction i didnt even need to take any pin killers
<mark4> no real pain at all
<mark4> and this dentist is literally 300 yards away lol
<neuro_sys> What's the fastest way to do memset with built-in Forth words?
<WilhelmVonWeiner> fill
<neuro_sys> Thanks
<WilhelmVonWeiner> np
<mark4> or erase
<mark4> erase fills with 0s
<WilhelmVonWeiner> would be surprised if erase was implemented differently to fill anyway
<cmtptr> interesting given flash usually resets to 1s
<mark4> erase uses fill
<mark4> erase is used on ram usually
<cmtptr> o
<Zarutian_HTC> cmptr: I have seen the output of flash often inverted
<cmtptr> weird. where?
<cmtptr> i was thinking of what i've seen on microcontrollers
<Zarutian_HTC> flash based rom-logic
f-a has quit [Quit: leaving]
<Zarutian_HTC> interesting electro mechanical combination lock I saw the design of the other day
<Zarutian_HTC> used 3x4 keypad, single normal relay, and a sort of resetable rotary advance relay-switch
gravicappa has quit [Ping timeout: 265 seconds]
<Zarutian_HTC> each button in the keypad had two normally open contacts
gravicappa has joined #forth
<Zarutian_HTC> in most of them one contact gave the electro magnet in the rotary advancer power
<Zarutian_HTC> so it would advance one step
<Zarutian_HTC> this setup basically allowed frequent change of the entrycode by simply replacing a holed card in the device on the locked side
<remexre> huh, I'd love to see a picture of that (can't visualize it from the description alone)
<Zarutian_HTC> the other contact in the buttons fed into rows of conductors that had kinks in them.
<Zarutian_HTC> the card would then be sandwitched between those rows and other conductors laid in columns
<Zarutian_HTC> if there was a hole in the card then at that place a row and coulmn conductors could make contact
<Zarutian_HTC> those coulmns then fed into the contacts in the rotary selector, which meant the rotary selector selected on column at time
<Zarutian_HTC> the effect was the card was read column by column as you punched in the code
<Zarutian_HTC> the relay, now I recall was actually kind of dual relay that implemented a SR latch
<Zarutian_HTC> the cards had eleven rows, ten for the ten digits and two for # which all codes ended on
<Zarutian_HTC> each code always started with * too
<Zarutian_HTC> the * was used to 'prime' the latch, which immediately cut that button out
<Zarutian_HTC> the wiper arm of the rotary selector was connected to the 'reset' relay electro magnet
<Zarutian_HTC> so the card had to have hole for every digit but the right one at that place in the code
<Zarutian_HTC> the eleventh row was actually two rows for the # button
<Zarutian_HTC> wait no, it was only one row
<Zarutian_HTC> ugh been a while since I saw the design
<Zarutian_HTC> anyway another contact in the # button gave power to a line that went through an arm on the selector, through a single contact there, through a normally open contact in the latch, and then onward to the door striker and the rotary selector reset electro magnet
<Zarutian_HTC> this sounds more complicated than it was
<Zarutian_HTC> but it worked fast and reliably for many years
<veltas> A good design can
<Zarutian_HTC> though it was a subject to the usual code guessing attack because you could hear the latch reset
<Zarutian_HTC> so, not quite timing attack against string compare used for passwords but similiar
<Zarutian_HTC> but meh, the code was changed everyday and this was on a door in a watched area
<Zarutian_HTC> and the code was eight digits long
<Zarutian_HTC> the trick they used for the code was for the most frequent users memorizing a base code eight digits long and then just plus mod 10 each digit with the todays date
<Zarutian_HTC> this was a door to a sizeable workshop room with lathes and such equipment
<astrid> interesting
<Zarutian_HTC> so this was more to keep out people that did not know the safety protocols
<astrid> that sounds reasonable
<Zarutian_HTC> I think they shortened the codes down to just six and used dates with the century elided
<Zarutian_HTC> put together mostly from industrial control components
<Zarutian_HTC> many years later they replaced it with an mcu but kept the card 'reader' because it was less hassle to change the code
<Zarutian_HTC> yikes! https://www.eetasia.com/fire-destroys-300mm-line-of-renesas-naka-factory/ I know that many electronics use Renesas cisc chips. Bosch automotive engine controllers included.
hosewiejacke has joined #forth
hosewiejacke has quit [Remote host closed the connection]
Zarutian_HTC has quit [Remote host closed the connection]
Zarutian_HTC has joined #forth
gravicappa has quit [Ping timeout: 265 seconds]
Zarutian_HTC1 has joined #forth
Zarutian_HTC has quit [Read error: Connection reset by peer]
Zarutian_HTC1 has quit [Remote host closed the connection]
<mark4> menus now fully functional yay
<veltas> :)
dave0 has joined #forth
<mark4> now is kind of the hard part
<mark4> developing a UI with this is a bit klunky with all the t's you have to dot and all the i's you have to cross... need a way to describe an interface in JSON or something
<mark4> which means writing a JSON parser beause i looked at everyone elses and they are horrendously over complificated imho
<mark4> or i could just use dev-libs/json-c
<veltas> You're not wrong that JSON parsers are bad
<veltas> And easy to write
<veltas> It's hard to write a good generic JSON parser, not that hard to write a good JSON parser for your exact purpose. But don't use sscanf on the whole buffer apparently because it's implemented badly
<mark4> can a dynamic library depend on a dynamic library?
<veltas> Yes
<mark4> i never use scanf lol
<mark4> i would probably memory map the entire json file for parsing
<mark4> i think i would prefer to write my own json code
<veltas> I've heard of this language that lets you write your own DSLs easily
<mark4> heh
<mark4> except im crippled
<mark4> cant use it here :P
<mark4> json parsing in forth would be way easier than in c
<veltas> Why are you even reading a data file?
<mark4> also... i NEVER code reursive algorithms
<veltas> Why not?
<mark4> because anything you can do WITH recursion can be done better without
<veltas> Have you scrutinised this idea?
<mark4> for example, to calculate the 40th fib using the common recursive methoid the function has to recurse on itself one hundered and fourteen MILLION times
<mark4> the one exception to taht is an ackerman function
<mark4> would not want to do that itteratively lol
<veltas> Or filesystem traversal
<mark4> nope. i would do that itteratively too
<mark4> and use stacks
<veltas> I've done both and it's shorter/cleaner recursively
<veltas> I'd only write iterative if I was adhering to MISRA C
<mark4> recurive algoritms are never clean. they are horrendously obfuscated to my brain
<veltas> Yes well a lot of people struggle with recursion :P
<mark4> i belive the gnu dev team wrote an itterative quick sort that was like 40 pages of horrible code
<mark4> just to prove how much better recursion is
<mark4> i bet i could write a very clean itterative qs algorithm
<veltas> It would give more weight to your argument
<mark4> someone already did lol
<veltas> : FACTORIAL ( n -- n!) ?DUP IF DUP 1- RECURSE * ELSE 1 THEN ;
<veltas> : FACTORIAL ( n -- n!) 1 SWAP 0 ?DO I * LOOP ;
<mark4> i would do that with a for loop myself
<mark4> but do loops work too
<mark4> : fib 0 1 rot 1+ 1 do tick + loop nip ;
<mark4> tuck not tick
<mark4> i cant type lol
<veltas> My second word is wrong
<veltas> Should be a 1+ after I
<mark4> oooh i just thought of something
<mark4> my menus dont allow for sub menus lol
<mark4> hrm
<mark4> maybe can get away without those
<veltas> mark4: How does for work? Is it like `0 ?DO`?
<mark4> 10 for .... next repeats 10 times but i refuse to use NEXT for this because next has special meaning in forth to me so i call it nxt
<mark4> my rep word is based on for loops
<mark4> 10 rep blah
<mark4> : foo 10 rep blah ;
<mark4> both work
<mark4> for puts the index on the returnstack and nxt counts it down and exits when it either gets to 0 or to -1 depending on whose implementation lol
<mark4> thats the disadvantage to for loops
<mark4> but CM prefers for loops to do loops and i agree. faster
<mark4> https://github.com/mark4th/x4/blob/master/src/kernel/io.s <-- look here on line 76 for a nice definition for type :)
<mark4> usually count 0 do i c@ emit loop ;
<veltas> If you click on the line number you get a link direct to the line
<mark4> if i click on the line number it gies me [...] to the left of it
dave0 has quit [Ping timeout: 245 seconds]
dave0 has joined #forth
<mark4> ooooh
<veltas> mark4: Look at your URL bar
<mark4> yea lol i JUST saw that lol
<veltas> I like how you're using COUNT to go through the string! I had not thought of that, very clever
<mark4> (type) is the definition above it
<veltas> I can read your source, as I've said before it's very readable
<mark4> yea this is a really short definition for type tho lol no do looping
<mark4> much faster
<mark4> and short and sweet :)
<mark4> it was an example of using rep which is based on for
<mark4> running valgrind on my menu execution shows no leaks still.
<veltas> It's basically : (type) count emit ; : type rep (type) drop ; for anyone who doesn't want to read the source
<mark4> :)
crc- has quit [Quit: ZNC 1.7.4 - https://znc.in]
<mark4> : (type) ( a1 --- a2 ) count emit ; : type ( a1 n1 --- ) rep (type) drop ;
<mark4> wth stack comments :)
<tabemann> hey guys
<mark4> hi
<veltas> mark4: Did you come up with that use of COUNT or see it somewhere else?
<veltas> Hi tabemann
<mark4> ive seen it used that wasy before but i got bitched at for using it like that once lol
<mark4> nothing wrong with it imho
<mark4> even tho its not getting a count byte exactly
<veltas> It confused me but when you understand it it's too briliant not to keep
<mark4> exactly lol
<mark4> beautifully simple like all forth should be
<mark4> ' count alias some-other-meaningful-name-here would apease the purists
<mark4> its like ' myconstant >body ! being EVIL i tell you
<mark4> so we have to have a new word "value" thats identical to constant
<mark4> and its ok to modify their value kthxbi
<mark4> / facepalm
<veltas> I think I disagree with your tendancy to try and factor into more functional stuff rather than just using inline loops
<veltas> But you're in good company, I know crc for one prefers the more functional approach
<mark4> i find optimizations by breaking things up
<veltas> Surely this has less overhead : type for count emit thn drop ;
<veltas> And as for optimisations... I'd hope it wouldn't really affect something like type's performance here
<mark4> by factoring out "count emit" i can reuse it in other defs
<veltas> Do you?
<mark4> i think i had a use for it but im not sure if it still exists
<veltas> Premature factorisation is something I try to avoid in Forth
<mark4> i think thas why i did that in the first place
<mark4> and i dont think calling a sub word in forth is any more expensive than any other kind of branch
<mark4> unlike in c where its expensive
<veltas> I just mean overhead as in memory usage
<crc> I don't obsess over factoring; though I do tend to factor more on code I plan to keep around long-term.
<mark4> i factor things because doing so often reveals optimizations i would not otherwise have seen
<mark4> and in c especially doing this makes the code more readable.
<mark4> because now that anonymous block has a name and now the code it was padding out is shortr and you can see more of it
<mark4> you can always static inline it :P
<veltas> When I say "premature factorisation" I think I mean the phenomenon of creating a word to represent a substring of another word to try and 'factor' it, even if the substring doesn't appear elsewhere
<veltas> I will do it if it makes a word a more readable length, sure
<mark4> kind of like negative string based compression :)
<KipIngram> Oh, I think there is value in short definitions even if it doesn't result in word re-use.
<crc> veltas: that's my main reason for factoring. Readability is important to me over performance or density.
<KipIngram> If a word is "appropriate to your lexicon," then it's likely valuable.
<veltas> Sometimes a longer word can be more readable
<KipIngram> Well, perhaps sometimes, but I suspect if the new word really resonates with your naming pattern then it's likely valuabl.
<veltas> Naming is important too, if it has a good name then sometimes that matters
<KipIngram> I try to wind up with most of my definitions 40-50 characters long.
<veltas> This is really getting into the structured programming principles
<KipIngram> I actually take the 64 character lines seriously.
* crc wonders how long his definitions are. A lot are definitely more than 40-50 characters.
<KipIngram> But, in support of your point, if a factorization is just completely arbitrary then it probably doesn't help readability.
<veltas> Forth definitely has a very structured bias, but I actually don't like the high-brow structured programming teachings like avoiding early exits etc
<KipIngram> Factoring just to factor, that is.
<KipIngram> You want to set out phrases that actually MEAN something.
<KipIngram> In the solution of your problem.
<veltas> I agree if you have a loose definition of 'phrase'
<veltas> To be honest, as long as it's documented, I don't mind if you break up into functions/words that don't have a particularly solid meaning without explanation
<KipIngram> I at least try to make code be at least somewhat self explanatory.
<KipIngram> You've got a name, you've got that name used in a sentence (context), and you've got the definition.
<KipIngram> I'm speaking really ideally here, of course - it's rare for everything to just dovetail perfectly.
<veltas> Yes ideals are good but not everything can be described in a sentence
<KipIngram> But if all three of those things play together in a strong way, you may not need further documentation.
<veltas> Definitely though, if it *can* be nicely described in a sentence, it should be
<veltas> Often when writing code I find you don't know what the verbs are until you've finished. Sometimes you need to get your hands dirty, be prepared to refactor at the end.
<veltas> If you pick the wrong verbs early on you end up rewriting a lot or getting stuck
<KipIngram> On this new system I'm writing right now I think I'm going to do a fairly formal implementation of shadow screens, just to make a place for that extra documentation.
<KipIngram> It's convenient on my screen to show two blocks side-by-side, so I thought I'd give it a try.
<KipIngram> My blocks are 4k, so I have 64 64 char lines.
<KipIngram> I have a full "navigate around and type" block editor, the full source of which fits on one such 64x64 block.
<KipIngram> Complete with wrapping it in a vocabulary and so on.
<KipIngram> Oh, I think wading in is always instructive. I try to always be willing to throw code away and "redo."
<KipIngram> Because of what you said - after you've done it you "see more clearly."
<tabemann> I personally tend these days towards having long but narrow words
<tabemann> where many words easy fit in 64 characters wide but don't really fit in 16 lines long