Ask HN: Was ES6 a Bust?
7 by no_wizard | 3 comments on Hacker News.
I been doing a lot of code reading in the front end land the last few weeks and I’ve noticed that much of not nearly all of the features of ES2016/ES2015 are hardly used. From what I’ve seen, even in big code bases like react, I only notice the the following: - Classes - Class Properties - Promises - A few object methods (entries, values, keys) - Arrow functions - async functions I see very little code, even in new projects, big or small, where any of the newer features are leveraged. Even things like Map and Set have sparse usage, despite their efficiency on modern JS engines. For instance I still quite commonly see code that is meant as value stores implemented as objects instead of a Map, even though Map has better performance in high deletion/write scenarios (if I recall correctly due to not touching the prototype chain) My favorite example being something like the redux state tree, which could be much more efficiently implemented with combo of Proxy + Map rather than a single mutated object. Proxy, Reflect, WeakMap and Weakset are non existent even more . The JS community definitely didn’t embrace custom iterators or generators, and symbol never seemed to have taken off as a way to provide library specific code extensions or properties I know Vue 3 leverages Proxies now but it’s not something I see much of in the wild otherwise Seems the advanced programming concepts and promises of ES6 are languishing. It’s still all objects and arrays and mostly still coded like in the ES5 era while leveraging mostly syntactic sugar rather than new features outright despite higher efficiencies I will say the limited Set API is rather annoying (you either have to convey it to an array or iterate over it to get a value out), other than that I don’t think the design of the newer features is harder to adopt, in a lot of cases I have found it’s easier Has this been anyone else’s experience? Edit: I speaking of new code or code that is generally being significantly re-written, or code being refactored that could benefit here. What I’m looking at is code written after ES6 was widely known and available

Post a Comment

Previous Post Next Post