-
Notifications
You must be signed in to change notification settings - Fork 241
Description
PRINT "$some string".
Variable some string is not defined.
The problem has to do with how the kRISC system flags the difference between "this string on the stack is a literal" from "this string on the stack is a variable's name". It does it by prepending a dollarsign to the string.
The fix would be to do one of two things:
1 - Use an "impossible" character instead of '$' as the flag - use something that a user probably cannot use as a character in a string - like a null char or a control char. Be careful to use something
from 1-byte ascii and not an extension from Unicode because these strings do get saved in packed UTF-8 in some cases.
or
2 - Provide a VarName object that is just a normal string, but wrapped in another class. Push that on the stack instead of $name and then when popping it off the stack, the system can read its class type to know it's a variable's name. This may make the ML file packing/unpacking a bit messy (because the ML file can only store primitives, not OOP class info) but there should be a way to do it.