BlocklyProp icon indicating copy to clipboard operation
BlocklyProp copied to clipboard

Implement typing in blockly variables

Open PropGit opened this issue 7 years ago • 4 comments

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: image

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'

PropGit avatar Oct 04 '18 15:10 PropGit

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.

MatzElectronics avatar Oct 05 '18 03:10 MatzElectronics

There are some methods in the newest version of the Blockly core that would help here immensely.

MatzElectronics avatar Oct 05 '18 20:10 MatzElectronics

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 .

PropGit avatar Oct 06 '18 06:10 PropGit

Issue #1678 is also affected by this.

MatzElectronics avatar May 29 '19 19:05 MatzElectronics