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…
> Regarding transpilation surely it's not as standard as you make it out to be? The impression I got from working on various projects over the past couple of years was that if the build doesn't include Babel/Webpack/Packet/etc then you're not doing a 'professional' job. > ... handwritten javascript is not that rare nowadays, is it? I love handwriting vanilla javascript, though I only really get the opportunity to do…
What’s New in ES2019
321–330 of 411 posts
Re: What’s New in ES2019
#322Earlier quoted context omitted.
And in the idealized fantasy world of Ayn Rand, any giant dinosaur enterprise corporation who insists on using antique outdated Jurrasic browsers deserves to be bitch-slapped by the invisible hand of the market into extinction for their outrageously dangerous security and privacy policies. To bad the real world doesn't work the same as it does in self-indulgent libertarian porn...
The real world works exactly like that. It's called System Requirements . If you want to use a piece of software, you look at the requirements and if you don't meet the requirements then you can't install it. All websites have system requirements, no matter how non-libertarian they seek to be, for example most websites will not work on IE6. It is not a fantasy to inform users that they don't meet the requirements, it…
Re: What’s New in ES2019
#323Earlier quoted context omitted.
I adore pattern matching when done well, but I'm sorry -- that syntax seems terrible and confusing. The use of `{ }` seems arbitrary. In JS braces are already used for both scope-delimiting and object literal notation; now they're going to have a third job? There has to be a better way. I understand it's based on destructuring; the syntax still just doesn't work for me.
Ocaml, StandardML, F#, Erlang, and Rust all use that syntax for pattern matching. What other syntax would you propose to test values in a JS object?
Re: What’s New in ES2019
#324Earlier quoted context omitted.
Also see assignment expressions recently adopted in python 3.8: https://www.python.org/dev/peps/pep-0572/
In Python things are a bit different because declarations and assignments are ambiguous.
Re: What’s New in ES2019
#325Earlier quoted context omitted.
Pattern matching is a really important feature but I strongly dislike that proposal because it feels like it introduces a bunch of single purpose syntax that's going to restrict the ability to evolve the language in future. It feels like it's an addon, not a holistic solution. I would much, much rather that type annotation syntax gets standardised first, because it is comparatively easy to build pattern matching when…
In JS, the pattern is the type. That is the point of duck typing.
How do you match against a `Buffer` pattern/type?
Re: What’s New in ES2019
#326Earlier quoted context omitted.
There are tools like create-react-app that configure complicated build pipelines for you, and there's parcel, a simple common-case build pipeline.
Again, just for the sake of playing Devil's Advocate, the fact that we rely entirely upon such helpers (and the overwhelming number of mutually exclusive options available) is a potential indicator that we're making it more complex than we have to[1]. The syntactic sugar that we're adding to make our own jobs easier is arguably making things disproportionately more difficult for anyone who doesn't already have the sa…
I'm afraid I don't know what you have in mind as far as syntactic sugar that makes things harder for learners. Every new syntax I can think of makes JS easier to learn and use.
Re: What’s New in ES2019
#327Earlier quoted context omitted.
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
#328Honest 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…
> 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. For one, not everyone works on the client. I can write for Node and use ev…
You totally can do that--but you probably shouldn't, because writing TypeScript is better for you and for future you. ;)
Re: What’s New in ES2019
#329Honest 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…
The primary benefit is that I don't have to rely on hacks.
This is how I build the backend to my CMS and my clients are happy to keep their browsers updated. (nearly trivial to do these days).
This also means that as soon as I see a new JS/CSS feature that will eventually become mainstream, I can use it in my admin as soon as both major browsers (Firefox/Chrome) support it. And even sooner if it's not a critical feature. (eg, I can skip adding a feature like "lazy loading" because browsers will have it built in eventually, etc...)
On the public facing front end, that is a different story though. It's motivation to keep things simple.
Re: What’s New in ES2019
#330Now 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