News for hackers. Stuff that matters.
Re:ECMAScript 2018: final feature set by gtirloni on Saturday February 03, 2018 @04:49AM (#16296948)
I understand JS was an experiment and that there was much to add to make it a proper language, but isn't it good enough now? Can we expect the pace of changes to slow down (specially in light of WebAssembly)? I'm not a JS developer and/or language developer, honestly just curious.
Re:ECMAScript 2018: final feature set by paol on Saturday February 03, 2018 @05:17AM (#16297023)
WebAssembly doesn't really have anything to do with Javascript. As for being good enough now: not yet. It's getting closer, another iteration or two and I think it could settle down for a while. Also it's worth noting the rapid pace of change in the JS specs is a recent phenomenon. It was stagnated for years before that.
Re:ECMAScript 2018: final feature set by ricardobeat on Saturday February 03, 2018 @09:28AM (#16297737)
WASM-compiled code might completely replace javascript, being faster at all stages: loading, parsing and execution. That's probably the point he was making.
Re:ECMAScript 2018: final feature set by krapp on Saturday February 03, 2018 @09:39AM (#16297766)
WASM compiled code doesn't improve upon the use of javascript as a scripting language, only javascript as 'bytecode.' I don't think WASM would replace javascript in those cases, unless you could drop another language into a script tag and have it work as easily for basic DOM manipulation, which people still do.
Re:ECMAScript 2018: final feature set by ricardobeat on Saturday February 03, 2018 @11:48AM (#16298307)
That’s true, but the vast majority of web sites today are already compiled applications.
Re:ECMAScript 2018: final feature set by krapp on Saturday February 03, 2018 @12:42PM (#16298557)
I think "vast majority" is an overstatement, unless you're counting by popularity and not sheer numbers.

I also don't consider a website serving machine-generated javascript to be a "compiled application" analagous to a C, Flash or Java binary (whereas WASM would be,) but almost every time I try to go down the "javascript is not machine code or bytecode" rabbithole, I get downvoted to oblivion.

Re:ECMAScript 2018: final feature set by z3t4 on Saturday February 03, 2018 @04:46PM (#16299862)
i find it amusing when a lower level lang compiles to a higher level. but i still think its the right word. another word is assembled when assembly goes into machine code.
Re:ECMAScript 2018: final feature set by irrational on Saturday February 03, 2018 @12:40PM (#16298549)
Vast majority? Do you have data to back that up? I'd bet the data would show far below 10% of websites are compiled applications (I'd be shocked if it approached 5%).
Re:ECMAScript 2018: final feature set by ricardobeat on Saturday February 03, 2018 @03:46PM (#16299542)
When I say 'compiled' I'm abusing the term to mean they have any kind of build step, and could not be written the same way by dropping code into a script tag [1] as said in the parent comment. For the most part what comes out of the build process could be replaced with WASM at a whim, whenever it gains access to all the DOM and browser APIs.

The majority of news, social media, video, media sites, message boards, online games and web apps fit this description. I'd wager that 95%+ of websites produced by a paid professional today are in this category. Unfortunately no, I don't have data to back this up, only my perception as a web developer.

[1] due to relying on a module system, es6 transpiler, etc

Re:ECMAScript 2018: final feature set by phpnode on Saturday February 03, 2018 @12:23PM (#16298488)
Majority of top 1000 websites perhaps, most websites aren't compiled at all, they just link to jQuery on a CDN somewhere.
Re:ECMAScript 2018: final feature set by ricardobeat on Saturday February 03, 2018 @03:55PM (#16299603)
WordPress powers almost 30% of the others, and could also switch to WASM whenever they feel like it.
Re:ECMAScript 2018: final feature set by mattbierner on Saturday February 03, 2018 @05:18AM (#16297027)
I don’t see JavaScript ever reaching a point where everyone involved agrees that is good enough. There are still too many conflicting opinions of what the language should be. The ecosystem’s constantly evolving libraries and frameworks also drive the language design, and new language needs are always emerging from these
Re:ECMAScript 2018: final feature set by ryanmarsh on Saturday February 03, 2018 @02:07PM (#16298995)
I don't like the idea of considering a language "good enough" and here's why.

First off I must be careful and acknowledge that a language which changes at a pace faster than the body of programmers using it can safely absorb could be considered an anti-pattern. As it stands I'm not sure if JS fits this.

Look at how Java has changed over the years. Back when it was created the syntax was appreciated by many as resembling C++ enough and being OO enough to be "good". Obviously there were many nits to pick by purists but programmers adopted the language and many people touted it. Java did not become popular because non-technical people were pushing it. Programmers liked it well enough.

I was a religious zealot when it came to OO. Now I find myself loathing large OO systems and trying to write procedural functional code as often as possible and only using classes when necessary. The Java language has evolved to add lambdas, streams, etc.. Should Java have added lambdas or should it have stayed the way it was, "good enough"? Even if one is a programming paradigm zealot of any persuasion one must acknowledge that a great deal of production code was written just fine using only the early Java language features. Should we have stopped there?

If code should be written first and foremost for programmers to understand and only incidentally for compilers to then it should stand to reason: as our collective understanding of how to express the behavior of a computer program evolves, so should the language(s).

Re:ECMAScript 2018: final feature set by gtirloni on Saturday February 03, 2018 @02:14PM (#16299020)
That makes a lot of sense, thanks for your thoughtful comment.
Re:ECMAScript 2018: final feature set by TheAceOfHearts on Saturday February 03, 2018 @05:13AM (#16297005)
No. There's still lots of ongoing work. There's a repo [0] with proposals and the different stages they're in.

Why would WASM mean slowing down JS changes?

[0] https://github.com/tc39/proposals

Re:ECMAScript 2018: final feature set by gtirloni on Saturday February 03, 2018 @05:27AM (#16297045)
Because people would start developing in other languages that target WebAssembly and demand less of JS today.
Re:ECMAScript 2018: final feature set by yayana on Saturday February 03, 2018 @05:53AM (#16297111)
Competing options lowering demands? I think that only makes sense if something has lost market share to the point that it is not in use.
Re:ECMAScript 2018: final feature set by chrismorgan on Saturday February 03, 2018 @10:41AM (#16298000)
Most people that write JavaScript don’t care about any of these new features. They are developed by those on the cutting edge, for those on the cutting edge. Eventually, some of them become more widely used, occasionally even going mainstream. (We’ve seen a rash of that in the past few years.) If the technology leaders all switched to WebAssembly and no longer cared about JavaScript, JavaScript development would stall, and people that still wrote JavaScript would probably breathe a sigh of relief as their target stopped moving. (It could still regain momentum after such an event.)

It seems very improbable to me that this will occur in the next five years.

Re:ECMAScript 2018: final feature set by partoa on Saturday February 03, 2018 @11:42AM (#16298275)
My two cents, JS has come a long way and should qualify as a "proper language" if it wasn't one before. Is it good enough? Is any language ever good enough?

As for the pace of changes, it's hard to tell. All the same, if TIOBE is to be believed, JS is getting more popular, not less.

Re:ECMAScript 2018: final feature set by rpedela on Saturday February 03, 2018 @01:12PM (#16298698)
JS still lacks support for 64-bit integers and BigDecimal support would be extremely nice. Otherwise I think the language is good enough.
Re:ECMAScript 2018: final feature set by johnsonjo on Saturday February 03, 2018 @05:04PM (#16299950)
Just in case anyone is not aware there is a stage 3 proposal [1] for 64 bit integers right now called BigInt [2].

[1]: https://github.com/tc39/proposals

[2]: https://github.com/tc39/proposal-bigint

Re:ECMAScript 2018: final feature set by _pdp_ on Saturday February 03, 2018 @05:24AM (#16297039)
JS is the language of the Web. The web is in constant flux. It is no surprise that the JS language will involve too.
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.
Re:ECMAScript 2018: final feature set by endless1234 on Saturday February 03, 2018 @06:39AM (#16297224)
Why stop adding new useful features? What actively used high level language has done that?
Re:ECMAScript 2018: final feature set by gtirloni on Saturday February 03, 2018 @06:46AM (#16297244)
>> Can we expect the pace of changes to slow down?

> Why stop adding new useful features?

No actively used languages that I know of have stopped adding features.

Re:ECMAScript 2018: final feature set by endless1234 on Saturday February 03, 2018 @08:57AM (#16297622)
Compared to ES5->ES6, I think these yearly bite-sized updates have indeed made it slow down and be much more manageable
Re:ECMAScript 2018: final feature set by tzahola on Saturday February 03, 2018 @07:30AM (#16297365)
LISP
Re:ECMAScript 2018: final feature set by ZenoArrow on Saturday February 03, 2018 @08:57AM (#16297623)
Lisp is a family of languages, there hasn't been a single Lisp language since the 1960s. The different dialects of Lisp add new features.
Re:ECMAScript 2018: final feature set by kazinator on Sunday February 04, 2018 @05:48PM (#16305422)
However, the major ANSI dialect hasn't changed since 1994, so OP has a fair point.
Re:ECMAScript 2018: final feature set by ZenoArrow on Monday February 05, 2018 @03:40AM (#16307477)
Common Lisp is a standard, but the various implementations of that standard have added non-standard features. For example, I believe Unicode support was added to SBCL around 2004.