Discuss Scratch
- Discussion Forums
- » Open Source Projects
- » ES6?
- liam48D
-
1000+ posts
ES6?
Some things I'd like to suggest involving ES6. I'm just wondering if it's okay if we use these things in the various projects?
ES6 supports destructuring:
Requires the extra –harmony_destructuring flag though.
Function methods of objects are a lot nicer now:
ES6 supports destructuring:
// old: var injectIntl = require('reactl-intl').injectIntl; // new: var { injectIntl } = require('reactl-intl');
Function methods of objects are a lot nicer now:
// old: var View = injectIntl(React.createClass({ ... getInitialState: function() { ... } ... }); // new: var View = injectIntl(React.createClass({ ... getInitialState() { // no more "function" ... } ... });
Last edited by liam48D (Feb. 2, 2016 16:39:00)
- kvackkvack
-
500+ posts
ES6?
You really do love ES6, don't you? :P
Anyway, I don't see why this wouldn't be okay. If you want to make a change to the site and can't resist using ES6, you can just use Babel (that's what it's called, right?) or something to compile it to normal, usable-for-ST code.
Anyway, I don't see why this wouldn't be okay. If you want to make a change to the site and can't resist using ES6, you can just use Babel (that's what it's called, right?) or something to compile it to normal, usable-for-ST code.

- GrannyCookies
-
100+ posts
ES6?
Problem is that Babel creates near-unreadable code. you can just use Babel
- liam48D
-
1000+ posts
ES6?
^^^Problem is that Babel creates near-unreadable code. you can just use Babel
- thisandagain
-
500+ posts
ES6?
We are starting to use ES6 modules in a few new projects and that style will likely make it back to the scratch-www repo in the near future. For now, we'd prefer that you stick with the coding convention we have established. Using ES6 modules with Babel requires some changes to our build process and thus would require quite a bit of additional testing and QA. Some things I'd like to suggest involving ES6. I'm just wondering if it's okay if we use these things in the various projects?
ES6 supports destructuring:Requires the extra –harmony_destructuring flag though.// old: var injectIntl = require('reactl-intl').injectIntl; // new: var { injectIntl } = require('reactl-intl');
Function methods of objects are a lot nicer now:// old: var View = injectIntl(React.createClass({ ... getInitialState: function() { ... } ... }); // new: var View = injectIntl(React.createClass({ ... getInitialState() { // no more "function" ... } ... });
- liam48D
-
1000+ posts
ES6?
Okay, sounds good.We are starting to use ES6 modules in a few new projects and that style will likely make it back to the scratch-www repo in the near future. For now, we'd prefer that you stick with the coding convention we have established. Using ES6 modules with Babel requires some changes to our build process and thus would require quite a bit of additional testing and QA. Some things I'd like to suggest involving ES6. I'm just wondering if it's okay if we use these things in the various projects?
snip

- liam48D
-
1000+ posts
ES6?
*scowls at somebody who's post got deleted*
EDIT: Oh looks like they got deleted. Yay moderators!
EDIT: Oh looks like they got deleted. Yay moderators!

Last edited by liam48D (Feb. 9, 2016 15:46:36)
- MegaApuTurkUltra
-
1000+ posts
ES6?
*scowls at somebody whose post got deleted*
EDIT: Oh looks like they got deleted. Yay moderators!
- liam48D
-
1000+ posts
ES6?
oh yes that makes sense, “who's” is “who has”. sorry i sometimes can't english.*scowls at somebody whose post got deleted*
EDIT: Oh looks like they got deleted. Yay moderators!
- Jonathan50
-
1000+ posts
ES6?
Ooh, ML/Haskell style pattern matching. Can you do it in procedure definitions…? ES6 supports destructuring:Requires the extra –harmony_destructuring flag though.// old: var injectIntl = require('reactl-intl').injectIntl; // new: var { injectIntl } = require('reactl-intl');
function foo(a, [b, c]) { console.log(b); console.log(c); } function bar({a, b}) { console.log(a); console.log(b); } foo(42, [1, 2]); bar({a: "foo", b: "bar"});


This makes everything more amazing.
But the one other thing ECMAScript is really really lacking is requiring tail call optimization.
EDIT: you can't match against literals and it's not exactly pattern matching, but whatever
Last edited by Jonathan50 (May 1, 2016 04:26:04)
- Jonathan50
-
1000+ posts
ES6?
But… Babel's output is compiled. It doesn't really matter what it looks like because you should be editing the source.Problem is that Babel creates near-unreadable code. you can just use Babel
- Discussion Forums
- » Open Source Projects
-
» ES6?