News for hackers. Stuff that matters.
Re:ECMAScript 2018: final feature set by chatmasta on Saturday February 03, 2018 @05:08AM (#16296996)
If it’s not breaking backwards compatibility then what’s the problem with improvements?
Re:ECMAScript 2018: final feature set by tzahola on Saturday February 03, 2018 @07:39AM (#16297381)
Because these constant "improvements" usually mean two things:

1. The language design is flawed. That is, the desired functionality requires changes to the core language, because it can't be made from existing building blocks. The fundamental language constructs are not universal enough, so new functionality will always require "just one more" special case in the language itself.

or

2. People are shoving things into the core language, that should rather be implemented as a library/framework.

Re:ECMAScript 2018: final feature set by danbolt on Saturday February 03, 2018 @03:39PM (#16299509)
20 years ago I used JavaScript to make cute Neopets pages, but today I get asked about how to use it for scalable web services in job interviews. That’s kind of crazy to me! It’d be like if Google made a JIT for LOGO and we all went nuts blogging about using it for ORMs.

I think JavaScript’s core foundation is changing because its use cases have rapidly changed. Like C++ or PHP though, it likely has a lot of legacy cruft.

Are any Ruby experts able to chime in if its language/runtime changed much after Rails hit the scene?

Re:ECMAScript 2018: final feature set by tomxor on Saturday February 03, 2018 @07:54AM (#16297422)
#1 'use strict' already went a long way to disabling broken parts of the language without breaking backwards compatibility. While what you are saying can be true in general, I find many of the features are more of a design correction that happen to work along side the old flawed way. Take 'var' vs 'let' / 'const' as an example.
Re:ECMAScript 2018: final feature set by marcosdumay on Saturday February 03, 2018 @11:02AM (#16298098)
What will they use once people are mostly using strict, but the language isn't yet good enough (because the keyword is already there, but it still isn't a good language)?

Keep adding rules and break the compatibility of strict code, or forget about it and live with current problems forever?

Re:ECMAScript 2018: final feature set by tzahola on Saturday February 03, 2018 @11:54AM (#16298341)
“use very strict”
Re:ECMAScript 2018: final feature set by TomMarius on Sunday February 04, 2018 @07:05AM (#16302423)
"use even stricter than very strict";
Re:ECMAScript 2018: final feature set by castis on Saturday February 03, 2018 @07:50AM (#16297416)
The language design is absolutely flawed, hence the push to make that less so.

What things going into core do you think should be a separate framework?

Re:ECMAScript 2018: final feature set by tzahola on Saturday February 03, 2018 @07:59AM (#16297439)
>The language design is absolutely flawed, hence the push to make that less so.

But a flawed language cannot be made non-flawed while keeping backwards compatibility... E.g. JS has now two different ways to write functions, with slightly different semantics.

>What things going into core do you think should be a separate framework?

An example would be async/await and generators, both which are just a special cases of coroutines. If JS would have coroutines, then these two would just be coroutine libraries.

Re:ECMAScript 2018: final feature set by alangpierce on Saturday February 03, 2018 @08:44AM (#16297588)
> But a flawed language cannot be made non-flawed while keeping backwards compatibility

Sure it can. Just introduce new syntax and discourage use of old syntax, ideally with tooling. For example, `var` is disallowed by any popular lint config, and for most practical purposes, it doesn't exist in JS anymore. The execution environment will still handle it, but it's not an available option when writing code in any professional or non-professional project I work on (because it won't pass lint).

Plenty of languages do this: Java raw types, Python old-style classes, goto in lots of languages. Python actually did a breaking change to remove old features, and it's a good example of how breaking changes can cause much more trouble than you might expect.

Re:ECMAScript 2018: final feature set by jmull on Saturday February 03, 2018 @12:11PM (#16298429)
> ...it's not an available option when writing code in any professional or non-professional project I work on...

That is surprising to me. I work with code that is more than a couple years old all the time and I would guess most people do to.

Re:ECMAScript 2018: final feature set by alangpierce on Saturday February 03, 2018 @05:08PM (#16299967)
Yeah, it's a slight exaggeration to say that `var` is effectively not in the language anymore, e.g. I see it plenty when reading open source projects or Babel output. Keep in mind that ESLint can autofix `var` to `let` or `const` (except in some rare cases when it's unsafe), so even if you have a big legacy codebase, it's not hard to migrate completely away from `var` with very little time or risk. But it's true that you need to keep up with tooling for legacy projects, which happens to be the case for the stuff I work on, but may not be universally true.
Re:ECMAScript 2018: final feature set by rmrfrmrf on Saturday February 03, 2018 @09:30AM (#16297741)
> E.g. JS has now two different ways to write functions, with slightly different semantics.

Just 2? More like 9:

* function expression

* function declaration

* arrow function (single line, single param)

* arrow function (single line, multiparam)

* arrow function (multiline, single param)

* arrow function (multiline, multiparam)

* object shorthand

* class declaration

* class expression

Re:ECMAScript 2018: final feature set by Veen on Saturday February 03, 2018 @12:03PM (#16298383)
It's not just syntactic differences either: they behave differently with regard to whether they're hoisted and the value of this.
Re:ECMAScript 2018: final feature set by minitech on Saturday February 03, 2018 @02:32PM (#16299110)
> An example would be async/await and generators, both which are just a special cases of coroutines. If JS would have coroutines, then these two would just be coroutine libraries.

async/await could be implemented with just generators, and were so implemented in ES6; async/await was added to the language because it was convenient. A language without full coroutines is fine.

Re:ECMAScript 2018: final feature set by akvadrako on Saturday February 03, 2018 @05:54AM (#16297115)
It obsoletes older browsers. For a while it used to be you could browse the web with almost anything, even a 10-year old Netscape. Now it's the norm that a 4 year old browser isn't supported, because of new APIs and JS syntax.
Re:ECMAScript 2018: final feature set by tcd on Saturday February 03, 2018 @06:27AM (#16297204)
Why do people like you feel that's acceptable? Software can work from anywhere between a few hours to a decade before an update is required, and it entirely depends on what you're doing.

Websites evolve, and that's the choice of developers around the world. You have no right to complain if you don't keep your software up to date to a reasonable level.

If you want to use 4 years old software, you MUST accept things are broken and that it's your fault. Try downloading Firefox 1-10 and see if they work today ;)

Re:ECMAScript 2018: final feature set by akvadrako on Saturday February 03, 2018 @08:03AM (#16297456)
I'm not necessarily against forcing upgrades because it comes with advantages, but I was explaining the tradeoff. It's one good thing about Apple and if say, domestic power outlets could change every few years, we could get higher voltages, DC, built in networking, more compact connectors, metering features, etc...

But if everything operated like the web ecosystem, we might consume 100% of our time and money just on upgrades.

And it pretty much guarantees there will only be a handful of vendors, because it's very expensive to stay current.

Re:ECMAScript 2018: final feature set by wwweston on Sunday February 04, 2018 @02:57PM (#16304560)
> Software can work from anywhere between a few hours to a decade before an update is required

All other things being equal, a decade is preferable because time/attention is valuable. Frequent and in particularly non-careful updates can put individuals and in the grip of a form of the red queen problem rather than being able to spend time/attention on new levels of capability.

I don't particularly mind some obsolescing of browsers where JS is concerned, and browsers in general have done a remarkable job of retaining backward compatibility.

More problematic, though, is the attitude that's more or less every website should be a JS-powered (or, in the future, web-assembly) SPA without any kind of back-end fallback for user agents that don't support it, thus making JS capability the bar for any UA. That's short-sighted, doesn't consider user conditions outside of a narrow range of experience, doesn't consider that there might be user agents other than browsers as commonly understood. If that's all you have the resources to do and how you choose to spend them, that can still be reasonable engineering (though my experience is the benefits of figuring out how to make it work w/o JS first -- if it's possible -- often pays engineering dividends), but I think it's weird it's the default now.

> Try downloading Firefox 1-10 and see if they work today ;)

Firefox 1-10 would be broken because they're embedded in a set of assumptions about specific non-web platforms, not because many (if not most) websites couldn't reasonably support them as clients. I don't see any reason to import the shortcomings of non-web platforms into the web.

Re:ECMAScript 2018: final feature set by irrational on Saturday February 03, 2018 @12:46PM (#16298580)
My view is, if everyone was on an evergreen browser (and didn't do something like turn off the auto updates) then there would be no such thing as a 4-year old (or even 1-year old browser). If I could wave a magic wand I'd have 100% of websites all using cutting edge HTML, CSS, JS features tomorrow so the WWW absolutely breaks for anyone not using an up to date evergreen browser (the lone exceptions being the download pages for Firefox, Chrome, etc.). The sooner businesses, Luddites and grandpas upgrade the better. But that's just my view as a developer who is so sick and tired of supporting browsers that have been out of support for years.
Re:ECMAScript 2018: final feature set by Yetanfou on Sunday February 04, 2018 @05:56AM (#16302285)
Your view excludes all platforms made before "evergreen browsers" became a thing and will exclude all platforms which the makers of "evergreen browsers" deem too small or unprofitable to support.

So thanks, but no thanks. There is enough of planned obsolescence already, no need to add another weapon to the arsenal.

Re:ECMAScript 2018: final feature set by Digit-Al on Saturday February 03, 2018 @06:10AM (#16297161)
If you haven't updated your browser for four years then you've got a hell of lot more to worry about than if javascript works correctly.
Re:ECMAScript 2018: final feature set by jsheard on Saturday February 03, 2018 @08:36AM (#16297562)
New syntax can obsolete older browsers, but it doesn't necessarily have to in the age of Babel and Typescript.

Babel can already translate ES2018 async iterators and rest/spread into ES5 code that works pretty much everywhere.

Re:ECMAScript 2018: final feature set by akvadrako on Saturday February 03, 2018 @09:20AM (#16297708)
If you are using babel there is no need for the new browsers to support the new syntax at all.
Re:ECMAScript 2018: final feature set by always_good on Saturday February 03, 2018 @10:03AM (#16297861)
Sure there are. For example, your bundle size shrinks when targeting newer browsers because more features exist, fewer need to be polyfilled.
Re:ECMAScript 2018: final feature set by akvadrako on Saturday February 03, 2018 @11:15AM (#16298153)
Then you must prepare two bundles, one for new browsers and one for old. I suppose that's possible, but doesn't seem worth it.
Re:ECMAScript 2018: final feature set by styfle on Saturday February 03, 2018 @01:21PM (#16298747)
You can use <script type=module> to target newer browsers. It’s definitely worth having two bundles because the ES6 and newer is much smaller. And one day, you stop shipping the old ES5 bundle.
Re:ECMAScript 2018: final feature set by TomMarius on Saturday February 03, 2018 @02:06PM (#16298993)
It is worth it most of the time.
Re:ECMAScript 2018: final feature set by orf on Saturday February 03, 2018 @07:10AM (#16297315)
That 4 year old browser is full of security holes though. Why would anyone want to encourage that?
Re:ECMAScript 2018: final feature set by Yaggo on Saturday February 03, 2018 @07:28AM (#16297361)
The more there's featues, the harder it will be to create new independent implementations, which is not good for openness/competition. The bar is already too high.