uliwitness / Stacksmith

An intuitive software erector kit targeted at people new to programming, but with enough potential to stay useful once they've learned, inspired by HyperCard.
http://stacksmith.org
128 stars 13 forks source link

Fix unquoted string literals when parsing "all variables are globals" handlers #91

Open uliwitness opened 7 years ago

uliwitness commented 7 years ago

Code without a handler around it in Forge in Webpage-mode and Stacksmith's message box parse into a handler that is set to make all local variables globals implicitly.

This conflicts with how unquoted string literals are implemented right now, which are parsed as local variables initialized with their name. That way, they behave like an interpreter: First, they are an unquoted string literal, but as soon as you put something in them, they get interpreted as a variable (even in a second iteration of a loop where the first one was the unquoted string, and at its end it was suddenly used as a variable).

Globals are initialized to empty strings instead of their names, and therefore unquoted string literals all end up empty. We should see if we can mark implicitly-declared globals as also needing to be initialized to their name.