Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move to ES6 #494

Closed
lgeiger opened this issue Nov 11, 2016 · 11 comments
Closed

Move to ES6 #494

lgeiger opened this issue Nov 11, 2016 · 11 comments
Labels
discussion 💬 Discussion is wanted

Comments

@lgeiger
Copy link
Member

lgeiger commented Nov 11, 2016

I would like to (re)evaluate if we should port our code base from CoffeeScript to ES6. Atom is slowly moving away from CoffeeScript as well.

My main motivation is to move Hydrogen closer to nteract and be able to use all ES6 features.

I just made a quick example plugin for Hydrogen in ES6 and was really surprised how easy it was.
We don't need a build step, we only need to add 'use babel'; on top of the file and Atom takes care of the rest.

I don't feel strongly against CoffeeScript but if think we should have this discussion.
@rgbkrk @n-riesco @nikitakit What do you think?

@lgeiger lgeiger added the discussion 💬 Discussion is wanted label Nov 11, 2016
@rgbkrk
Copy link
Member

rgbkrk commented Nov 11, 2016

I'm certainly more likely to contribute if it's ES6 instead of CoffeeScript.

@n-riesco
Copy link
Collaborator

Also note that since the latest Atom uses Node v4.4.5, in some cases 'use babel'; may be avoided too.

@lgeiger
Copy link
Member Author

lgeiger commented Nov 11, 2016

I'm certainly more likely to contribute if it's ES6 instead of CoffeeScript.

For me this argument is sufficiently to switch. 😄
And I imagine you are not the only one.

@n-riesco Node 4.4.5 doesn't support all ES6 features so this could lead to strange errors. With babel we would be definitely on the save side.

One sad thing, we would lose our position in the github developers ranking for coffeescript 😜

@n-riesco
Copy link
Collaborator

On 11/11/16 16:44, Lukas Geiger wrote:

@n-riesco https://github.com/n-riesco Node 4.4.5 doesn't support all ES6 features http://node.green/ so this could lead to strange errors. With babel we would be definitely on the save side.

I chose my words carefully for that reason. A few more thoughts:

  • I think the most compelling argument to start using Javascript is to lower the hurdle our contributors have to jump.
  • Using all the ES6 features may put off some developers that work mostly with browsers.
  • Since version 1.0.0 is coming soon, this is a perfect time to plan this transition.
  • Do you have anything in mind about what this transition to JS would look like?

@lgeiger
Copy link
Member Author

lgeiger commented Nov 12, 2016

I think the most compelling argument to start using Javascript is to lower the hurdle our contributors have to jump.

That's the reason why I raised this discussion.

Using all the ES6 features may put off some developers that work mostly with browsers.

I agree. I'm not familiar with them either but we could use them if we need to.

Do you have anything in mind about what this transition to JS would look like?

If we really wan't to move to JS I would propose this short term plan (post 1.0.0):

  • I'll be traveling to NY on monday (wooo 🎉 ) and have some time during the flight to do boring tasks, so I volunteer to move the entire codebase to JS (including eslint). Probably with the help of decaffeinate. The only thing I fear and will probably miss is the existential operator in coffeescript.
  • Then we should discuss (probably in a dev meeting) how we'd like to move forward. I really want to make use of more code from nteract (kernelspecs, enchannel, rx-jupyter, ...).

I don't have the background in JS you have. So if you say moving to JS just for the sake of change doesn't make sense, I'm absolutely OK with it.

@nikitakit
Copy link
Contributor

No opinion on language change.

But if you do end up switching to JS, please make sure that all the files use strict mode. ('use babel' should include this, but otherwise you may need 'use strict' at top of each file)

@rgbkrk
Copy link
Member

rgbkrk commented Nov 12, 2016

I'm happy even if I'm writing vanilla ES5, we probably aren't going to use most ES6 features. Even node 4 was a dramatic improvement.

@rgbkrk
Copy link
Member

rgbkrk commented Nov 12, 2016

The only thing I fear and will probably miss is the existential operator in coffeescript.

That's my favorite feature from coffeescript that didn't end up as part of ES6.

Our best bet here is to rely on lodash heavily with _.has, _.at and _.get. Lodash has excellent deep path support. We already have it as a dependency if I recall correctly.

@rgbkrk
Copy link
Member

rgbkrk commented Nov 12, 2016

It would be neat to see if you can convert single files within the code base to JS (with use babel; at the top) yet still require them from coffeescript in Atom.

@lgeiger
Copy link
Member Author

lgeiger commented Nov 12, 2016

It would be neat to see if you can convert single files within the code base to JS (with use babel; at the top) yet still require them from coffeescript in Atom.

That totally works!

@n-riesco
Copy link
Collaborator

The only thing I fear and will probably miss is the existential operator in coffeescript.

I never tried to convert a project from CS to JS, so this is going to be a good opportunity to gain some experience. At first, I'd try to decaffeinate only one module.

As Kyle suggests above, taking the route of _.has et al. seems the most straight forward replacement for ?. This route will raise the hurdle for new contributors and make more difficult to remove the dependency on lodash (if we ever wanted to). As a guideline, mostly for the sake of a lower hurdle for new contributors, I'd try to limit the use of lodash to the necessary cases.

I don't have the background in JS you have. So if you say moving to JS just for the sake of change doesn't make sense, I'm absolutely OK with it.

This was Slava's thought, but in this case there is a reason for changing to JS: gaining new contributors.

@lgeiger lgeiger mentioned this issue Nov 15, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
discussion 💬 Discussion is wanted
Projects
None yet
Development

No branches or pull requests

4 participants