You are reading a single comment by @Gordon and its replies. Click here to read the full conversation.
  • 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!

    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/com­mits/0858ecfb5e6b1f894ce8648f750098ce4a1­950f5

    I'd be interested to see what you think?

About

Avatar for Gordon @Gordon started