Linux Kernel Module written in Scratch (a visual programming language for kids)
I teach Scratch to children professionally. It is such a brilliant learning tool—except for one thing that annoys me so much!<p>One of the first things we have kids try to create is a game called &quot;Ghostbusters&quot;. The first step is &quot;make your ghost hide and show every two seconds.&quot; Nearly every student codes something like this:<p><pre><code>    forever
        hide
        show
    ⬏
</code></pre>
The result is a ghost that does not do anything. Not the best introduction!<p>I always tell the kids some variation of &quot;the computer is going too fast&quot;, so they&#x27;ll add a wait block. Their code need the wait block anyway, but it would be better if they could see what was happening and figure it out on their own. Also, my explanation is actually bullshit. Think about it—the ghost should be hidden as often as it&#x27;s visible. Furthermore, if the kid does:<p><pre><code>    forever
        show
        hide
    ⬏
</code></pre>
...their ghost will disappear and never reappear! Can you figure out what&#x27;s happening yet?<p>Well, consider this. If you do:<p><pre><code>    move 10 steps
    move 10 steps
    move 10 steps
</code></pre>
...your sprite will jump forwards 30 pixels all at once. But, if you do:<p><pre><code>    repeat 3 times
        move 10 steps
    ⬏
</code></pre>
...then the sprite will <i>animate</i> forward, moving ten pixels per frame for three frames.<p>Scratch only updates the screen at set &quot;yield points&quot;, which are basically any instruction containing the word &quot;wait&quot; (reasonable enough) and after each iteration of a loop (very problematic). Loops should not have side effects! It&#x27;s much more difficult to teach iteration when the unrolled version does something completely different!<p>But the problem is deeper than that—it pops up everywhere with basically every student I work with, because it prevents kids from seeing the results of their code! Fundamentally, two blocks in the same script which request a screen update should not be able to run on the same frame. (Unless the user has enabled turbo mode, which is already an option for advanced users who need to push the limits of the language.)<p>I know that all languages have quirks, but I just don&#x27;t know what Scratch&#x27;s developers were thinking here, or why I seem to be the only person who considers this a massive problem!<p>I made a fork of Scratch which fixes this problem, but I&#x27;m not really sure what to do with it. Without a backend for saving projects to the cloud, I can&#x27;t realistically use it in my classes. I&#x27;ve been trying to add a backend, but the code is undocumented and I have zero experience with backend development. <a href="https:&#x2F;&#x2F;github.com&#x2F;LLK&#x2F;scratch-vm&#x2F;compare&#x2F;develop...Wowfunhappy:scritch-vm:develop" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;LLK&#x2F;scratch-vm&#x2F;compare&#x2F;develop...Wowfunha...</a>