Implement typing in blockly variables
The Print text block happily accepts a non-string variable (non-char*) and succeeds in compiling but causes ugly warning and of course won't work as user expected.
This project:

produces this code:
/* SERIAL_TERMINAL USED */
// ------ Libraries and Definitions ------
#include "simpletools.h"
// ------ Global Variables and Objects ------
int item;
// ------ Main Program ------
int main() {
print(item);
}
and this response at compile time:
Compile... Succeeded.single.c: In function 'main': single.c:16:3: warning: passing argument 1 of 'print' makes pointer from integer without a cast [enabled by default] /opt/parallax/Workspace/Learn/Simple Libraries/TextDevices/libsimpletext/simpletext.h:309:5: note: expected 'const char *' but argument is of type 'int'
This can be done, but it's going to require type checking to be done correctly across ALL blocks, and that's a pretty major task. Since this isn't a show-stopper - I suggest delaying this one for now.
There are some methods in the newest version of the Blockly core that would help here immensely.
That's good to hear. No rush though.
On Fri, Oct 5, 2018, 1:04 PM Matthew Matz [email protected] wrote:
There are some methods in the newest version of the Blockly core that would help here immensely.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/parallaxinc/BlocklyProp/issues/1561#issuecomment-427483338, or mute the thread https://github.com/notifications/unsubscribe-auth/ABNSjntMRKrC0JDEzMqa5XOPvuNy-KA2ks5uh7sygaJpZM4XIVk4 .
Issue #1678 is also affected by this.