Live data from Hacker News

What’s New in ES2019

blog.tildeloop.com

191–200 of 411 posts

Re: What’s New in ES2019

#191
post #38

Why did they create a flatMap method? What is wrong with .map(...).flat()? Can they improve the performance by combining it that much?

And more importantly what is essentially verbatim in your question:

Why is flatMap = map().flat() and not flat().map()

Re: What’s New in ES2019

#193
post #54

Earlier quoted context omitted.

What would some common/helpful use cases be?

Functional transformation of objects. There are lots of HOFs working on arrays / iterators but none working on object. fromEntries allows easily converting from object to entries, manipulating the entries sequence and converting back to an object. The last step is pretty annoying without it. The entire thing is very common in Python, where Object.entries() is spelled `.items()` and `Object.fromEntries(…)` is spelled…

It's a lot more verbose than _.mapValues() is, but it's nice to have a relatively simple solution without using a library.

Re: What’s New in ES2019

#195
post #78

That array.flat() and array.flatMap() stuff is great to see. Always having to rely on lodash and friends to do that type of work. Exciting to see how JS is evolving.

I dig it too, but you could previously flatten an array with concat, and the spread operator. [].concat(...array) Lodash wasn't necessary.

Heh, didn't know that. Thanks for the tip :)

Re: What’s New in ES2019

#196
post #33

Earlier quoted context omitted.

String#padStart already exists: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...

But we still have trimLeft() and trimRight() and in true JS tradition we need some more redundancy for symmetry's sake.

As in the MDN article:

    All major engines have also implemented corresponding trimLeft and trimRight functions - without any standard specification. 
So ES2019 implements trimStart() and trimEnd(), which are symmetrical to padStart() and padEnd(), but trimLeft() and trimRight() aliases are maintained as not to break working code.

Re: What’s New in ES2019

#197
post #158
post #139

Earlier quoted context omitted.

That's not unique to JS. Some compilers took over a decade to implement C99 features. Most of us C coders were still defaulting to C89 for portability well into the late 00's. But now C99 is mainstream enough that you can (mostly) safely target it. If you never release new standards you'll never be able to use them. I realize that in JS world 4 years is basically an eternity so it's hard to project that far but I'm s…

> It's popular to be sure but handwritten javascript is not that rare nowadays, is it? Long time front end developer here. In the last couple of years I can't recall seeing even a single project without a build pipeline (not that they don't exist, I just haven't encountered them at my day job, first or third party).

I was able to create a full web app using Preact with no build pipeline at all. It was not the best experience mostly because of no concatenation.

I ended up adding Parcel for easy Typescript support.

Re: What’s New in ES2019

#198
post #49

Earlier quoted context omitted.

Clojure too didn't change a lot. In these years of 'disruption' it feels odd. But it may just be that we forgot stability and maturity.

Existing Clojure APIs don't change, but Clojure adds a lot more than this each year. Look at spec, reducers, transducers &c

Well reducers and transducers were big announcements. IIRC clojure 1.10 didn't add any feature of that scale, and few people mentioned that it was quite a "smaller", without criticizing. spec seems important but is still alpha status.

Re: What’s New in ES2019

#199
post #139

Honest question, not meant to be inflammatory. If we still need to target es5 4 years later, and transpilation is standard practice, why bother? Is the evolution of JS not directed in practice by the authors of Babel and Typescript? If no one can confidently ship this stuff for years after, what’s the incentive to even bother thinking about what is official vs a Babel supported proposal. I like the idea of idiomatic…

That's not unique to JS. Some compilers took over a decade to implement C99 features. Most of us C coders were still defaulting to C89 for portability well into the late 00's. But now C99 is mainstream enough that you can (mostly) safely target it. If you never release new standards you'll never be able to use them. I realize that in JS world 4 years is basically an eternity so it's hard to project that far but I'm s…

It's a bit different with compiled code though right? If you stop supporting the previous C revision, it means the person compiling your code need to upgrade their compiler, the executable will work for everyone on that platform once built.

Whereas in JS-land, the support for upgrades is even more trailing because it's the end-users who need to upgrade, not just the individual/organization doing the packaging.

Re: What’s New in ES2019

#200
post #184
post #158

Earlier quoted context omitted.

> It's popular to be sure but handwritten javascript is not that rare nowadays, is it? Long time front end developer here. In the last couple of years I can't recall seeing even a single project without a build pipeline (not that they don't exist, I just haven't encountered them at my day job, first or third party).

I made this recently just because I wanted to prove to myself that it was possible to have a modern frontend application without all the overhead of build tooling and I have to say I'm pretty happy with it. You can use some of the most important things in browsers today like CSS variables, and ES module imports. https://gitlab.com/WA9ACE/frontend-starter

That's an interesting project template. Manually managing dependencies and using backbone sounds quite fun!
Post reply on HN