User talk:Chunes: Difference between revisions

meta words and pi
(meta words and pi)
Line 116:
 
::::: Glad you figured it out! Btw, I like your translation of Oforth in the Pi task. I can't get over the elegance of the meta control flow words. --[[User:Chunes|Chunes]] ([[User talk:Chunes|talk]]) 21:12, 30 January 2021 (UTC)
 
::::::Yeah, the meta words were something that gave me a real "Holy Crap!!!" moment during development. I knew from Lisp that there was goodness in metadata, and from Phil Koopman's book [https://users.ece.cmu.edu/~koopman/stack_computers/ Stack Computers] that there was goodness to be found in making Every. Single. Op-code. The. Same. Size. so those were guiding principle. The first Holy Crap around control flow was "nests always start at 0 and end at -1, and everything is the same size, so I can do control flow without needing to make it something special for the compiler to deal with - there's no "where do I need to jump to?" the answer is "the start", "the end" or "over 1 or 2 from here". The meta- aspect came about because I was getting all knotted up trying to get <code>traverse()</code> to work whilst the control flow words screwed about with the program counter. (My mam used to work at a massive petroleum cracking plant. (ICI Billingham) The engineers there regularly worked on thousands of volts DC live whilst standing on layers of rubber mats. Once in a while one would hand a spanner to his mate, ''not on a mat'', and get flung across the room. Working live on stuff can suck.) My coding woes all disappeared as soon as I decided to modify the PC at arm's length by working on the return stack instead. And so the meta-words were born. THEN I got the second "Holy Crap when it dawned on me what potential they had.<br><br>(Incidentally, there are more meta- operators than are strictly necessary - <code>]else[</code> can be replaced by <code>]'[ drop</code>, and <code>]iff[</code> with <code>]if[ ]'[ drop</code> (probably ... it dawned on me a couple of weeks ago and I haven't actually tested it to be 100% sure.)<br><br>The only thing I haven't explored the potential of is <code>]do[</code> and … thinking about it while I type … that means I haven't stress tested it and … OMG! I'll be back in a few minutes. … … … Yup, I thought so. There was a bug-in-waiting there. Fortunately it was a quick fix and the code is shorter and marginally faster as a result. :-) That'll be included when I release the fix to bigrat.qky.<br><br>Pi … the final phase of testing bigrat is coding some stuff that I didn't think of in case my internal biases are guiding me around writing code that will uncover bugs. So I've found a few suitable tasks in RC and coded those, and they work. :-) And while I was looking for stuff I chanced on Pi and thought, well that'll be quick and easy and I've been wanting to do a Pi spigot since I heard of them. I do enjoy watching endless digits scroll up the screen.<br><br>Now all I need to do is update TBoQ and bounce it all up to GitHub. I'll leave it a day or two though in case anything else dawns on me.<br>--[[User:GordonCharlton|GordonCharlton]] ([[User talk:GordonCharlton|talk]]) 01:06, 31 January 2021 (UTC)
1,462

edits