3 ms·
You can't deny that ECMAScript 6 has given some much needed CPR to the Javascript language, but I think we have yet to see the true potential of Javascript disc
by DigitalSea 12y ago
You can't deny that ECMAScript 6 has given some much needed CPR to the Javascript language, but I think we have yet to see the true potential of Javascript discovered. I love the addition of modules, classes and all of the other new additions to the spec including my favourite => arrow functions. Small steps towards being a half-decent language.
I am already thinking ahead, ES7 is definitely going to be the pinnacle of the language I think. The implementation of a native Object.observe() means we will not have to worry about poor implementations in SPA frameworks like Angular that currently use dirty checking and other hacks to make up for the lack of native object observing. Lets hope the yearly release cycle proposed for Javascript specifications means ES7 happens sooner rather than later.
We have classes in ES6 (which is great), but they are currently nothing more than syntactic sugar over the old tried and tested prototypical inheritance. There are plans to add statics, private/public variables and classes to further extend them beyond just eye candy which they currently are. Plus Async/Await, Typed Objects, etc. There are also plans to better supported multithreading without the need to use WebWorkers which are pretty limited in their use.
Get excited. ES6 is only the beginning of a great suite of changes coming to Javascript. We'll eventually weed out the hacks and non-pretty parts of Javascript one specification at a time.
- habitue 12y agoThe changes you're hoping for sound like turning js into a java/c# kind of language
- iends 12y agoOr Dart.
- frik 12y agoJS5 was nice, but the ES6 direction is increasingly driven by people who come from the C#/Typescript and Java compiler front. Was it really necessary to add "class" syntactic sugar? Some of the new ES6 and new Rust1.0 syntax additions seem to be driven by the Ruby/Python/Scala front and don't look like proper C/C++/JS/PHP syntax. Hopefully ES7 doesn't get the verbose syntax of Java/C#. If people want syntax XY they should use a transpiler to JS or emscripten & asm.js. A good example is Facebook's Hack language that improve PHP in a sensible way and adds optional typing - something that would be great for ES6/7.
- vidarh 12y ago> Was it really necessary to add "class" syntactic sugar? Necessary? No. But look around at Javascript projects, and see how many "reinventions" of simple inheritance you see. Often poorly done and/or buggy. Even more often they're hopelessly inconsistent. What a lot of the ES6 changes does is codify ways of doing what "everyone" has been doing in mutually inconsistent ways.
- arcatek 12y ago> Was it really necessary to add "class" syntactic sugar? I think it was. Using the class syntax gives a semantic meaning to the code that propotype wasn't. And if you think it was, then what was the point of typing again and again MyClass.prototype.<> ? Refactoring Javascript code was a pain, and an excessive identifier redundancy was part of it.
- ahoge 12y ago> Was it really necessary to add "class" syntactic sugar? Yes. Now your editor/IDE knows that that thing is supposed to be a class. The doc generator also knows that it's a class. Furthermore, this makes things more compatible since framework A and library B use the same kind of classes. Finally, it means that you won't have to waste time with evaluating a dozen semi-popular options to handle classes/inheritance. It does of course also make your code a lot easier to read and it makes it easier for new developers who used some other language with classes before. > Hopefully ES7 doesn't get the verbose syntax of Java/C#. I recommend to take a look at TypeScript and Dart. Optional types aren't verbose. You just add some types to the surface area, which, compared to JSDoc, is drastically less verbose. Inside functions, you can generally omit the types.
- castell 12y agoOptional types are great. I think he meant static types like in Java / older C#
- frik 12y agoIt's a pity that optional types are still missing in ES6. As I wrote: A good example is Facebook's Hack language that improve PHP in a sensible way and adds optional typing - something that would be great for ES6/7. In comparision the Java/C# type is static at compile time. Newer C# version have like e.g. Visual Basic 6 a variant type that is a tradeoff (as wasteful as a "union struct" in C). The class syntax in ES6 is just syntactic sugar. JS IDEs like WebStorm/PHPStorm/IDEA already can parse "classes" with JS5 syntax . But what about the arrow syntax: var odds = evens.map(v => v + 1); Or the iterator syntax that ES6 got from TypeScript: interface Iterable { [Symbol.iterator](): Iterator }
- tarikjn 12y agoAgreed. It goes against the current shift from OO programming to functional programming. I hope Javascript remains a somewhat simple language which syntax can be easily memorized.
- deleted 12y ago[deleted]