taweili / ardublock

ArduBlock is a Block Programming Language for Arduino.
GNU General Public License v3.0
413 stars 292 forks source link

Subroutine names accept chars that are illegal in C #142

Open hukka opened 8 years ago

hukka commented 8 years ago

For example it's possible to name a subroutine "Hello world". Either it should do some kind of translation (remove all illegal chars, replace with underscores etc.) or prevent writing those chars already in the GUI.

TonyCallear commented 8 years ago

The problem is already 'solved' for variable names and could easily be applied to subroutine names... but keep in mind there are different illegals which might occur at any particular place in the name.

Any simple substitution solution risks having names which are different on the screen being translated into the same name in the code. eg &V and ?V might both be V in the code.

A slightly more complex solution (like for variable names now) makes reading the code as text in the arduino IDE more difficult (I'm thinking of school kids, I admit) - encouraging people to read the code as text and eventually coding in text is a good thing - I think?

I think that before someone's writing subroutines maybe they should just be taught about or have come accross the idea of illegal characters?