Copyright © https://mongoose-os.com

Mongoose OS Forum

frame

MJS Bug

It seems that MJS has a bug where the next line cannot be parsed if an object definition isn't terminated using a semicolon:

let data = {
    a: 1,
    b: 2
}
print('test')

gives the following error:
MJS error: parse error at line 5: [('test')]
it makes the reason hard to determine, and i think according to spec it shouldn't even fail.

Comments

  • mamuespmamuesp Germany/Northern coast

    Assignments with lethave to be terminated with an semicolon in MJS AFAIK. As in JavaScript semicolons are added to open endings, this is quite dangerous and leads to lazy code. So in MJS you have to set them by your own. Not using semicolons is bad code. Hence this is not a bug. See some explanations here. A hint from experience: always use semicolons!

  • atmegaatmega Schweiz

    OK, well if it's on purpose then I'm 100% happy with that. I just noticed it because V8 does it differently :)
    And yes, always using semicolons seems to be the sensible way to go.

Sign In or Register to comment.