sweet-js/sweet-core

Compile to JavaScript without semi colons

jochemstoel opened this issue · 4 comments

Please implement an optional parameter to compile JavaScript without semi colons.

What? Why?

What do you mean why? A large portion of developers in the world do not use semi colons (anymore), many of them strongly opinionated. I refrain from the debate about this but I don't want semicolons either.

The parser generator and code generator I am currently using do not include this option either. This is enough reason for me to find a replacement that does. I was looking into alternatives that meet the requirements when I stumbled upon sweet.

I completely understand if this is not a priority for you or is too much work. In that case no problem I will find something else.

/* no semi colons needed */
function Droid(name, color) {
  this.name = name
  this.color = color
}
Droid.prototype.rollWithIt = function (it) {
  console.log('rolling just fine.')
  return this.name + " is rolling with " + it
}

You're not supposed to edit generated code. It's generated code.

Wouldn't this substantially increase the complexity of the generator because now it needs to be wary of situations where semicolonless expressions are parsed wrong?