The Worst Bugs are by Design
/The latest version of PythonIsh is coming along a treat. I spent most of today fiddling with working on the code. And I fixed a silly bug. My new command to send MQTT messages from a Pythonsh program wasn’t working when entered into a program. Although the command worked fine when entered from the terminal. What’s going on? Turns out quite a lot. But first, some background:
Pythonish is a thin wrapper on top of a thing I’ve called HullOS which runs programs that are implemented as two character statements. Some HullOS statements have extra data on the end. For example I have the command:
rtHello World
This is in the “remote” family of commands (that’s what the r means) and it transmits an MQTT message (that’s what the t means). The rest of the command is the message to send (Hello World). There are command families for quite a few letters of the alphabet now. Remote commands are special. They control receipt and storage of remote programs. The rm command says “Don’t perform the statements I’m going to send you, instead store them to run later”. Then the rx command says “I’m done with storing code, lets go back to performing statements”.
When I implemented these commands it occurred to me that it would be silly to allow running programs to initiate remote downloads and whatnot as this would get really confusing really quickly. So, I built the code so that r commands are never added to stored programs.
And then I wrote a bunch of extra r command behaviours which do need to be stored in program code. Idiot me. I’ve fixed it now. I’m not sure what the lesson is here, other than “Don’t do stupid things”. And add big comments on code which behaves differently from the norm.
If you want to follow my journey and have a play with the code (we even have some documentation now!) take a look here.