NuScratch: Getting around the 'Unknown class: SmallFloat64' error
Today I learned…
Polish schoolchildren learn the basics of coding in the MIT Scratch creative programming environment. I was very happy when my oldest daughter really got into programming and asked me if we can “have Scratch at home”.
But we do have Scratch at home, I told her.
Scratch at home (when trying to save a project):
Jokes aside, I was quite frustrated because NuScratch, the continuation of the original Scratch, simply failed to save any coding projects created within it.
I kept getting the same error on all three Linux machines at home, pretty much regardless of which combination of (Squeak image × NuScratch version) I tried. The same error kept popping up on all our household machines: a void linux box, a devuan box, and on the raspberry pi os. Even though NuScratch was installed by default on the Raspberry Pi as part of the “recommended software” bundle!
It took me a week of debug attempts, trying to figure out how NuScratch
operates and how the GUI is put together in Squeak Smalltalk. I had a lot of
fun and learned quite a bit about the Smalltalk ecosystem. When I finally got
to the failing code/tests in question (the
ObjStream class cannot write
files), I realized that the problem lies in deep 32-bit assumptions made in the
original Scratch serialization protocol.
So, since googling for the solution failed to surface any hints, here is the solution.
Q: My Scratch or NuScratch system errors out and displays the following pop-up when I try to save my project:
Error: Unknown class SmallFloat64.
A: Make sure you are running a 32-bit Squeak VM on a 32-bit operating system. On Raspberry Pi, this will be something like