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

Consider authoring in ES6 #42

Closed
tomek-he-him opened this issue Jan 6, 2015 · 17 comments
Closed

Consider authoring in ES6 #42

tomek-he-him opened this issue Jan 6, 2015 · 17 comments

Comments

@tomek-he-him
Copy link
Contributor

It's another idea than #38. Author in ES6, transpile to a universal module format for node, AMD and the browser.

The original idea came from Ryan Florence some time ago. I've followed his advice in tomekwi/as.js. The technology is still quite rough, but everything seems work smoothly.

@tjmehta
Copy link
Owner

tjmehta commented Jan 7, 2015

Cool, thanks I will check this iut

@tjmehta
Typed using my thumbs..

On Tue, Jan 6, 2015 at 7:46 AM, Tomek Wiszniewski
notifications@github.com wrote:

It's another idea than #38. Author in ES6, transpile to a universal module format for node, AMD and the browser.

The original idea came froom Ryan Florence some time ago. I've followed his advice in tomekwi/as.js. The technology is still quite rough, but everything seems work smoothly.

Reply to this email directly or view it on GitHub:
#42

@tomek-he-him
Copy link
Contributor Author

One more thought. Reading that

101 will be maintained to [... match] a widely supported JS version

– maybe we could branch out an experimental 2.0.x branch, tailored to ES6? Without the cruft which already comes bundled in ES6 (like find or assign)?

This could be used as it is in ES6 projects, and optionally compiled to ES5. 6to5 does a great job with that.

If you're interested, you can have a look at tomekwi/mithril-n – I've managed to polish my ES6 workflow for testing and compilation.

@tjmehta
Copy link
Owner

tjmehta commented Feb 16, 2015

I am still unsure about all this ES6 stuff. It seems you guys have a lot more experience that me about all the options. When you two (@tomekwi, @stoeffel) have been using using es6 I am assuming you are probably transpiling your code (for browser usage) or using node with flags.

In both of these cases, how are you importing other npm modules?

@stoeffel
Copy link
Contributor

I'm often using 6to5(now babel) with a pretty straightforward workflow.
I have a .es6 next to the transpiled .js file. Checkout https://github.com/stoeffel/chickencurry as an example. But we could have a es6 folder with the files we are working on and transpile them into the root of the project and add the es6 folder to npmignore.

how are you importing other npm modules?

You can reguire modules like this import foo from 'foo';. Checkout https://github.com/stoeffel/partition-all/blob/master/index.es6#L3

I can create a simple proposal if you like?

@tjmehta
Copy link
Owner

tjmehta commented Feb 16, 2015

I just saw what you proposed in #62. Make sense, but I think you may have misunderstood my question.
Let me try to be more clear with what I am asking.

My main question is:
When developing an ES6 module/application is it difficult to import CommonJS modules?

I don't think I'd want to start implementing 101 in ES6 until it is widely supported (and wouldn't require transpiling to ES5). Reasons include: mainstream readability, easier for contributors, avoid transpiling, avoid doubling size of source, etc. Thoughts?

@stoeffel
Copy link
Contributor

When developing an ES6 module/application is it difficult to import CommonJS modules

No you just import it.

I don't think I'd want to start implementing 101 in ES6 until it is widely supported

I think then we shouldn't move to es6. But I think there is no down side to transpiling, a lot of libraries are doing it and developers are getting more and more used to it. IMHO es6 code is often easier to read. If we add a CONTRIBUTING.md contributors know where they should change things.

doubling size of source

es6 files can be excluded from npm.

@tomek-he-him
Copy link
Contributor Author

how are you importing other npm modules?

@tjmehta, what @stoeffel says is true when working with babel. All ES6 modules are simply transpiled and run as ES5 – whether in node or in the browser (via webpack or browserify). So import foo from "bar" becomes var foo = require("bar").

But, as a matter of fact, ES6 specs say nothing about supporting CommonJS or AMD.

However: when an implementation of modules comes to node, I'm 100% sure they'll work out of the box with CJS – otherwise the whole ecosystem of npm would become useless. For browsers we'll need some kind of a workaround to marry modules and CJS – but today we need workarounds for that just as well.

@tomek-he-him
Copy link
Contributor Author

I don't think I'd want to start implementing 101 in ES6 until it is widely supported

Working with babel is pure pleasure :) But I must admit I had a hard time in a project compiled with traceur. In order to use 101 I had to fork, "transpile" all of 101's functions to ES6 – and watch out not to use those, which pull in CommonJS modules.

So I think an ES6 version would already improve accessibility.

And after all, it's a step which will need to be taken sooner or later :)

@tomek-he-him
Copy link
Contributor Author

es6 files can be excluded from npm

I'm not sure I'd do that @stoeffel. There are people who'll want to pull the ES6 version directly – for example to avoid doubling some of babel's runtime code in webpacked code.

@stoeffel
Copy link
Contributor

There are people who'll want to pull the ES6 version directly – for example to avoid doubling some of babel's runtime code in webpacked code.

Okay, didn't know that. Thx

@stoeffel
Copy link
Contributor

Working with babel is pure pleasure :)

💯 👍

@stoeffel
Copy link
Contributor

@tjmehta I guess you have to decide if you want to switch or not. Clearly @tomekwi and I are pro ES6 😄
How about you pull #62 into a es6 branch and tinker a bit on your own to get a feeling if you like it or not?

@tjmehta
Copy link
Owner

tjmehta commented Feb 25, 2015

I am punting on this for now. I know ES6 traction is picking up fast. Let's revisit this idea after a few months. Long answer here: #62

@tjmehta tjmehta closed this as completed Feb 25, 2015
@tjmehta
Copy link
Owner

tjmehta commented Nov 11, 2015

Reopening this for discussion.
Circumstances have changed with node4 supporting many ES6 features.
Keep in mind, browser support for ES6 is still quite fragmented.
Any ideas on how we can transition to support ES6 features?

@tjmehta tjmehta reopened this Nov 11, 2015
@cflynn07
Copy link
Contributor

@tjmehta using babel presets, such as es2015 should make it easier to write features in ES6. Anything you write in ES6 would be transformed to browser compliant JS. As browsers add support for ES6 features, new presets will be created. You can swap which preset you use with babel to get the latest ES6 supported features.

http://babeljs.io/docs/plugins/preset-es2015/

@tjmehta
Copy link
Owner

tjmehta commented Dec 30, 2015

I am thinking about making a breaking change to 101 in early 2016 to assume es6 as the widely supported JavaScript.

Optimally I would like to support es5 and es6, but only use transpiled code for es5 environments.

Typed using my thumbs..

On Dec 30, 2015, at 11:56 AM, Casey Flynn notifications@github.com wrote:

@tjmehta using babel presets, such as es2015 should make it easier to write features in ES6. Anything you write in ES6 would be transformed to browser compliant JS. As browsers add support for ES6 features, new presets will be created. You can swap which preset you use with babel to get the latest ES6 supported features.

http://babeljs.io/docs/plugins/preset-es2015/


Reply to this email directly or view it on GitHub.

@tjmehta
Copy link
Owner

tjmehta commented Aug 25, 2016

moving es6 convo to #150

@tjmehta tjmehta closed this as completed Aug 25, 2016
@rstacruz rstacruz mentioned this issue Aug 25, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants