There's been an issue open on GitHub for a while, where 'normal' JavaScript should throw an error if you use a variable without defining it first, but Espruino doesn't:
a=1; // no error
console.log(b); // should throw 'ReferenceError', but Espruino doesn't
Now usually having ReferenceError is great, because it stops loads of mistakes that would otherwise go un-noticed, like:
Serial1.setup(9600, { parity:'odd' }) // Ok
Serial1.setup(9600, { parity:odd }) // Error (variable odd is undefined, so you'd actually get no parity)
foobar = 1;
digitalWrite(LED1, fooBar); // Error (case sensitive, so fooBar->undefined->0)
However I'm very conscious that most of us probably do have some errors that are currently going un-noticed and actually aren't causing any problems... So would you feel fed up if you updated the Espruino firmware and then your program stopped working? At least it would at least tell you where the problem was!
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
There's been an issue open on GitHub for a while, where 'normal' JavaScript should throw an error if you use a variable without defining it first, but Espruino doesn't:
Now usually having ReferenceError is great, because it stops loads of mistakes that would otherwise go un-noticed, like:
However I'm very conscious that most of us probably do have some errors that are currently going un-noticed and actually aren't causing any problems... So would you feel fed up if you updated the Espruino firmware and then your program stopped working? At least it would at least tell you where the problem was!
I've just implemented this, but on a branch called ReferenceError. The latest build with it on is now here if you want to check it out: http://www.espruino.com/binaries/git/commits/0858ecfb5e6b1f894ce8648f750098ce4a1950f5
I'd be interested to see what you think?