Bug: Variable and parameter names starting with a digit fail

Issue #68 resolved
Turgut Guneysu created an issue

Hi John,

I noticed today that if a custom block parameter has a name that starts with a number, it causes problems on reload of the program.

I created a block with input parameter named “8Bits” as type number or string.

While testing the code, it all worked OK.

After I saved it and reloaded it, the block definition changed the parameter name to “8”.

And the SAY block was modified to what is shown below.

Upon trying to save the program, it gave an error saying “First Argument must be a string”.

The only way out of this condition was to delete the argument of the myBlock definition and redefine it with a variable name that DOES NOT start with a number. Then all was OK.

The BAD part is this:

If one discards the Debugger message by clicking on “X”, as printed on top, in fact the program is NOT SAVED !

I did not notice / know this and repeated the same cycle several times in my program. At some point I started getting recursive errors in the terminal window and had to abort the microBlocks program.

Then when I restarted microBlocks and reloaded my program, I noticed NONE of my changes were recorded ever since the problem with the argument name started. Wow, what a surprise!

By the way, the same thing happens if just a VARIABLE is declared with a name that starts with a number.

Except that in that case, the program SAVES OK. But sometimes on reload it will HANG microBlocks with a “not responding” message.

If I terminate microBlocks and restart it, and load the program, it loads OK

BUT one notices that the variable name used in the SAY block has been modified from SAY 8Bits to SAY 8 Bits and the variable SET block is gone !

I know better now, but I wanted to check if this is a bug or I was violating a variable naming rule?

TG

Comments (5)

  1. John Maloney repo owner

    This is definitely a bug! Thanks for reporting it. We’ll fix it, but for now avoid starting a variable name with a digit or minus sign.

  2. Log in to comment