3 ms·
I think it's important to separate two major categories of recent JS additions: 1) Advanced features that cannot be replicated without runtime support 2) Synt
by brundolf 5y ago
I think it's important to separate two major categories of recent JS additions:
1) Advanced features that cannot be replicated without runtime support
2) Syntax sugar
Symbols, BigInt, and generators are the former. Pipes and classes are the latter. (1) gives library authors access to low-level primitives that can allow them to do things that were literally impossible before (I've gotten a lot of use out of Symbols, personally), but they aren't often used directly in application code. (2) are usually more application-facing, and may or may not be a big enough quality of life improvement to justify their existence.
I guess what I'm saying is: just because you haven't seen lots of Symbols or generators in the wild doesn't mean they aren't having an impact, or weren't worth adding.
- jamesknelson 5y agoTo add to this point, it’s quite likely that the vast majority of JavaScript developers are using generators and symbols, whether they realize it or not. The reason is that your build system of choice will typically have been compiling async/await into a combination of generators and iterators for years now. It’s probably getting to the point where it’s no longer necessary in a lot of cases, but these constructs that “nobody uses” were able to implement the newer and more widely features long before they were available in browsers.
- valand 5y agoMore point to add: (1) Adds more possibilities, performance improvements, operational shortcuts. (2) Adds redundant way to do one thing. IOften confuse more than help in the long run. The former also should not be excluded from application code. Application coder should also be familiar with what those are for.
- franciscop 5y agoThere's libraries to work with BigInt without "runtime support". Arguably Symbols and Generators cannot get there 100% of their features without runtime support, but for the vast majority of usecases out there (Symbols as a unique keys, generators as a stream of data) there are many ways of doing that with JS without the need of these constructs that are just as clean. For instance, Symbols solve such a very edge case (key collision) that IMHO it's def not worth creating a whole new abstraction for it. > they aren't often used directly in application code The problem for me with this is that abstractions leak, and suddenly you are wondering why you cannot add two simple numbers or why there's a 3rd level of hidden properties in objects.
- jimmont 5y agoThe teams working on evergreen browsers seem to be the more effective place for vetting the continuum between and including 1 and 2--they do remove features. Certainly better than the various experiments across the Internet (including the black hole npm).