rainforestapp / decaf

Coffeescript to ES.next transpiler. Now maintained over at
https://github.com/juliankrispel/decaf
MIT License
106 stars 10 forks source link

Decaffeinate #155

Open petrbrzek opened 8 years ago

petrbrzek commented 8 years ago

Is this the same project https://github.com/decaffeinate/decaffeinate or different?

eventualbuddha commented 8 years ago

They are different. They take different approaches to the same problem.

rmacklin commented 8 years ago

@eventualbuddha If you can elaborate on the differences, that would be much appreciated.

eventualbuddha commented 7 years ago

In short, decaf maps the CoffeeScript program structure (AST) into a JavaScript program structure, then generates JavaScript based on that.

On the other hand, decaffeinate uses the CoffeeScript program structure to modify the original CoffeeScript source code to change it to become JavaScript source code.

There are pros and cons to each approach, so which one you use depends on your priorities. Decaf is simpler and may be less likely to produce code with syntax errors. Decaffeinate preserves comments and formatting as much as possible.

One other thing that is different that isn't a matter of approach is that decaffeinate is more actively developed and runs daily against several popular open source CoffeeScript projects and runs their tests in some cases, which helps identify issues in decaffeinate.

rmacklin commented 7 years ago

Thanks for the reply @eventualbuddha. Even before you answered, I experimented with both and I ended up liking decaffeinate's output more (as you said, the comments/formatting were better preserved, which was desired). I successfully converted several dozen CoffeeScript files to ES6 with quite readable diffs! Great tool 👍