scratchfoundation / scratch-vm

Virtual Machine used to represent, run, and maintain the state of programs for Scratch 3.0
http://scratchfoundation.github.io/scratch-vm/
BSD 3-Clause "New" or "Revised" License
1.21k stars 1.51k forks source link

"change [variable] by (1)" block does not result in NaN when manipulating strings #1879

Open thisandagain opened 5 years ago

thisandagain commented 5 years ago

Expected Behavior

Executing the "change [variable] by (1)" block on a variable that is currently set to a string should result in NaN

Actual Behavior

The variable is set to 0

Steps to Reproduce

image

Reference

https://scratch.mit.edu/projects/275276918 https://llk.github.io/scratch-gui/develop/#275276918

Major HT to Scratcher hahasamian for identifying this issue!

/cc @kchadha @ktbee

apple502j commented 5 years ago

Wait, compat wiki mentions this. https://github.com/LLK/scratch-vm/wiki/Compatibility#consistent-type-coercion-when-modifying-variables Should it be fixed or kept? @thisandagain

thisandagain commented 5 years ago

@apple502j Yeah. This was one of the very first things we decided to change. I'd like to discuss this.