Live data from Hacker News

What’s New in ES2019

blog.tildeloop.com

111–120 of 411 posts

Re: What’s New in ES2019

#111

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…

Different products/teams can move at different speeds if they target a specific market. For example, for internal apps teams can expect that browsers are up-to-date, or that even only a specific browser will ever run the app. Also, people who write JS for back-end (eg node.js) or an embedded engine can control the environment their code runs in, and can use more up-to-date features.

It’s similar to all the new tweaks and elements in HTML or DOM. If you’re working on Wikipedia, you will likely never get to use them. But if you work on a more niche app, they become quite useful. Over time, old browsers die out, and the amount of people who can use new features expands; early adopters do the testing for the late majority.

Re: What’s New in ES2019

#112
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.

Re: What’s New in ES2019

#113

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…

IMHO the current state of affairs is actually the best possible scenario.

- Experimental language proposals can be tested in the wild

- Real non-ivory-tower feedback is raised to TC39

- Everything feeds into the canonical ES spec (~no splintering)

- Us regular folk are able to harness new syntax immediately

- Users continue to have their old runtimes supported

Re: What’s New in ES2019

#114

Now if we could just get pattern matching[1] and optional chaining[2], that would really elevate things. [1] https://github.com/tc39/proposal-pattern-matching [2] https://github.com/tc39/proposal-optional-chaining

Optional chaining is stage 3, and major engines are actively implementing it.

Re: What’s New in ES2019

#115
post #99
post #91

It's very exciting to see how JavaScript is evolving!

Honest question, not playing. What is exactly exciting about it? 2020 is around the corner and the language created back in 1995 is only now getting features that have been standard in many other languages, either as part of the core language or the standard library for decades.

Well, I'd think that was pretty obvious, right? It's exciting because if you spend the day writing JavaScript I don't give a hoot that another language has had that feature for decades because I don't get to use that other language.

Are you implying that no other languages ever add features that other languages have? All languages except JS are feature complete? Come on..

Re: What’s New in ES2019

#116
post #110

Now if we could just get pattern matching[1] and optional chaining[2], that would really elevate things. [1] https://github.com/tc39/proposal-pattern-matching [2] https://github.com/tc39/proposal-optional-chaining

What's the point of pattern matching? Why not just a switch statement?

Switch pivots off of one value, pattern matching allows you to match on types, destructured values, conditional execution based on the existence (or lack thereof) of those values or types. It's much more flexible then switch (but arguably more complex).

See Scala[1] or Swifts[2]'s implementations.

[1] https://docs.scala-lang.org/tour/pattern-matching.html

[2] https://docs.swift.org/swift-book/ReferenceManual/Patterns.h...

Re: What’s New in ES2019

#117
post #3

It's great to see JS getting some of the features of better planned languages. But I'm still very nervous about some of the stuff mentioned here with regard to mutation. Taking Rust and Clojure as references, you always know for sure whether or not a call to e.g. `flat` will result in a mutation. In JS, because of past experience, I'd never be completely confident that I wasn't mutating something by mistake. I don't…

I still don't understand why neither JSs var or let allow you to redefine the variable with the same name. I makes chaining things while debugging so much harder: let a = a.project(); let a = debug(a); let a = a.eject(); vs let a1 = a.project(); let a1d = debug(a1); let a2 = a1d.eject();

Without getting into the merits of allowing redefines in a loosely typed language, the simple reason why JS can't support this is hoisting.

Any var/let statement of the form var a = 1; is interpreted as 2 statements. (1) The declaration of the variable which is hoisted to the beginning of the variable scope, and the (2) setting of the value, which is done at the location the var statement is at.

Having multiple let statements would mean the same variable is declared and hoisted to the same location multiple times. So it's basically unnecessary and breaks hoisting semantics.

In addition, the downside risk of accidentally redefining a variable is probably far greater than the semantic benefits of making the redefinition clear to a reader (esp since I think that benefit is extremely limited in a loosely typed language like JS anyways).

Re: What’s New in ES2019

#119

Can we get some additions that replace the garbage one-liner `is-even`/`is-odd` npm libraries that are a scourge?

You mean something like x % 2 === 1?

I'm a JS fan but had to admit I chuckled at the implementation of is-even: https://github.com/jonschlinkert/is-even/blob/master/index.j...

Re: What’s New in ES2019

#120
post #35

That Function.prototype.toString change is probably going to break some Angular.js code who relies on scanning function argument names for dependency injection.

The Function.prototype.toString change has been in chrome for maybe a year now btw.
Post reply on HN