ECMA TC39: “SmooshGate” was officially resolved by renaming flatten to flat
developers.google.com
developers.google.com
Catering to an implementation that does bad things is an awful way to build standards, but it's only going to happen again and again and again unless the developer is forced to pick a version and build / maintain compatibility with exactly that version.
Because I don't know what would happen if you don't define your version in script tags, it'll default to I guess LTS, which wouldn't have fixed this issue, right?
Unless there is a will to plow the ranks of committee sitters, and remove inadequate people, you will never see that till the moment the web platform kicks the bucket.
The number of breaking changes since nineties is high hundredth already. Just each time they were opting to "break just few percents of websites, after careful considerations"
I suspect that the cost (in both maintenance hours and performance overhead) to maintain parallel JS engines is extremely non-trivial.
I don't know what kind of backward compatibility is inherent in their designs, but just remember <marquee> if you think that browsers have to support all features ad infinitum.
Adding new backward-compatible features does not require branching the engine, neither does removing older features.
The quirks/standards-mode distinction did require branching engines, and it has lead to increased complexity and testing burden. It was necessary at the time to move forward so the cost was accepted, but it is a complexity burden all browser have to carry for the foreseeable future. There should be a very good reason to introduce such branching - wanting to write "flatten" rather than "flat" is not a good enough reason.
Marquee was never supported by all browsers. But the article does mention some widely supported elements where support have been removed (<keygen>, <applet>) so it is not unheard of. But it requires that the element is almost never used on the web. Apparently this is not the case for MooTools library in question which still has some penetration.
https://blog.thoughtram.io/angular/2016/02/01/zones-in-angul...
I can imagine Angular zones becoming problematic in exactly this kind of way in a few years...
While monkey patching in general is problematic, monkey-patching Array or Object is much worse than monkey-patching Window.
In the case of Angular zones, if additional async APIs are added to the browser, Angular needs to be updated to patch them with its own zone implementation.
This wouldn't break existing sites, but could leave, for example, sites on older angular versions unable to use new browser APIs, use libraries that use new browser APIs, or install security updates to dependencies if newer versions rely on new browser APIs.
> Why don’t we just keep the existing name and break the Web?
> In 1996, before CSS became widespread, and long before “HTML5” became a thing, the Space Jam website went live. Today, the website still works the same way it did 22 years ago.
> How did that happen? Did someone maintain that website for all these years, updating it every time browser vendors shipped a new feature?
> As it turns out, “don’t break the Web” is the number one design principle for HTML, CSS, JavaScript, and any other standard that’s widely used on the Web. If shipping a new browser feature causes existing websites to stop working, that’s bad for everyone:
> - visitors of the affected websites suddenly get a broken user experience;
> - the website owners went from having a perfectly-working website to a non-functional one without them changing anything;
> - browser vendors shipping the new feature lose market share, due to users switching browsers after noticing “it works in browser X”;
> - once the compatibility issue is known, other browser vendors refuse to ship it. The feature specification does not match reality (“nothing but a work of fiction”), which is bad for the standardization process.
> Sure, in retrospect MooTools did the wrong thing — but breaking the web doesn’t punish them, it punishes users. These users do not know what a moo tool is. Alternatively, we can find another solution, and users can continue to use the web. The choice is easy to make."
Who ever thought future progress can be sacrificed just so that some obscure website (obscure because it is no longer supported, people no longer care) can work for 22 years during which the world has changed so much that this website is probably no longer relevant under any objective measure.
I mean yes, maintain SOME backward compatibility but dragging bs like typeof null === 'object' all along is just nuts.
Some people care about books, even books written by people long dead. And some people care about the content on some older websites, even if they are not using the newest flashy framework.
As developers, we hate the demands of legacy code and backward compatibility. We would like to scrap everything and rewrite in the cool new language and framework every few years. But a browser is not only a fun playground for developers. It is a tool for accessing information for people who couldn't care less about what an identifier is called in JavaScript. They just want it to work.
The alternative would to design the web so that only popular and "relevant" sites can expect to be viewable in the future, and to arbitrarily break everything else. But the web isn't (or shouldn't be) structurally biased towards the size or traffic of a few specific sites, and an obscure decades old site no one cares about has just as much of a right to remain functional as any other.
MooTools went further by copying “all methods from Array” onto another MooTools object, “Elements.” THAT broke, because the standard Array.flatten would be non-enumerable, and so it wouldn’t get copied to Elements, and so Elements.flatten would fail.
1. The number of websites using the old version of Mootools is vanishingly remote, relative to the number of existing websites not using it, and the number of as-yet-unmade websites who will also not use it (but who will be harmed by the committee's dedication to retarding the development of the language).
2. Of those websites using this old version of Mootools, the number that use flatten, and do so in a way that would definitely be broken by the introduction of standardised "flatten", and wouldn't be fixed thereafter is, statistically speaking, zero.
3. Most of the same people who are affecting concern about backwards compatibility in the case of the web work for tech giants who regularly retire products and APIs that are relied upon by thousands of people, and make backwards incompatible changes to their operating systems that break masses of unmaintained apps.
But the fact is, you can't make arguments like this to groups like the TC39 and expect to even get a hearing. Despite their occasional spiel about seeking outsider feedback they are, like any institution, happy in their long-settled groupthink positions, and reflexively frightened and dismissive of any challenge or criticism by outsiders.
You saw this when the whole "smoosh" affair first broke. There was a long, passionate, but civilised debate about it on GitHub (https://github.com/tc39/proposal-flatMap/pull/56 ) which was abruptly cut off by a TC39 committee member, who locked out non-contributors entirely, with the dishonest claim that things had become "too heated". What he really couldn't stand was the sight of the committee's dogma being challenged.
Remember that next time the representative of a standards body whines about lack of participation in the process by regular web developers. It's a lie. These groups are only interested in the opinion of outsiders if they align with a set of fixed and unchallengeable precepts, and they will revert to depressingly familiar suppression of speech the moment it looks like things aren't going their way.
Also, at least two, maybe three comments were moderated for violated the code of conduct, and the commenter admitted his language was inappropriate. So there's an argument to be made that the conversation was too heated. Again, you can disagree, but your opinion doesn't make anyone else's invalid or bad-faith.
I also saw multiple committee members discussing the counterarguments, and by the time the thread was locked it was essentially just rehashing the same points. So I find it hard to agree with your claim that they refused to hear dissenters.
https://gist.github.com/paulirish/a135445fc84f7ca5c486b52d56...
TC39 can't introduce breaking changes because browsers won't implement breaking changes.
Browsers won't implement breaking changes because users would switch to other browsers which don't implement breaking changes.
It doesn't matter whose "fault" it is, if a website works in one browser but not in another, users are going to use the browser it works in.
If it were easy to remove unpleasant features from the platform, browser vendors would be the first people clamouring to make it happen. For example, off the top of my head, there is widespread agreement that it would be good to get rid of, or otherwise improve in backwards-incompatible ways:
* Sync XHR * document.open * document.write * AppCache * localStorage
But that can't happen, because the desire of browser implementors to simplify their implementation is less important than the need to keep sites running. Apart from anything else, as stated uptrehad, breaking sites is a sure and certain way to get people to switch to a different browser.
Tell a regular browser user they will lose access to their favorite website forever because JavaScript developers prefer writing "flatten" to "flat".
Inconsistency aside, naming non-accessor functions and methods nouns is a bad practice anyway.
+1 though. I'd really like to see a version of JavaScript not only with new features, but also without some (all?) of the weird semantics it was once dreaded for. That can certainly only happen if it's versioned.
And you would almost certainly have to specify in the source code which version of the language you wanted to adhere too. You couldn't assume it would be the latest, because that would break your code in the future, when the latest version has deprecated whatever feature you relied upon way back.
Ugly no matter how you look at it.
Some people in web standards community and dotcoms will protest. There are big believers in "Live version"
It is very sensible thing to do, but you need to kick these people out of committees. Despite the numerous attempts, none has succeeded at that yet.
HTTP has versions. IP has versions. A lot of APIs have versions.
Why? Because sometimes you want a new feature but the current API does not support it. So you break it and make a new one, keeping the old intact.
I can already tell my webbrowser which HTML version I use. That should and can be extended further.
Similarly it would be great if I could tell my webbrowser "Use compatibility level for 2010-2019" or "Use compatibility level 2000-2010".
This is how things should work. But other than impossible to remove proponents of hardcore live versioning, there are even more proponents of "Keeping 20 years old websites intact without changing a single line of code." So a valid JS 1.0 must still also be a totally valid ECMAScript 2017.
Those believe that it is somehow physically possible to engineer the language parser that it use some extremely sophisticated lexic tools to guess what version of JS something the code refers, those also are the proponents of "lets guess the api version by counting the number of arguments, and if we need a new one, we just add one more"
This is bad.
Why such people can't be taken down from standard committees? One of reason that people close to web standards making process don't want to discuss is that "tech/corporate strategists" at top dotcoms misguidedly believe that by making web standards an impossibly complex to implement thing, they can prevent appearance of newcomers to the browser market, thus making browsers a moat for competitors to drown in.
As Joseph Stalin said - "In a democratic society, the people who rule are not the ones who vote, but ones who count those votes." Those corporate appointees surely share this ideology - Ones who control the Internet business are not companies who run websites, but ones who write browsers to browse them: want to kill an advertising supported website? Put them into Google's secret bad websites list; want to displace a credit card processing competitor? Ban him from using the credit card API to which the browser is locked; want to kill a legal video streaming website? Deny him rights to DRM extensions in the browsers; and like this for all and everything.
You don't need that luckily, we have DOCTYPE to tell us something about the version of a document.
A simple `<!DOCTYPE html js2018>` would be sufficient IMO though it might break older browser (but honestly, screw everyone still using IE8)
On the other hand we have WASM now and once we get proper integration into browser I imagine things might get better.
I see so much API breakage in modern software ecosystems that I consciously try to minimise my dependencies so I don't have to spend all of my time constantly updating my code to work with the latest versions of everything. One only has to look at disasters like the transition from Python 2 to Python 3 to see how much pain breaking changes cause for both developers and users.
If TC39 took the attitude of "hey, here's a cool new feature, who cares if it breaks a bunch of existing sites, everyone can update their code, right?" then web developers would never get to make actual improvements their sites or do anything cool, because they'd be stuck in a constant cycle of maintenance hell. Sure, I find it silly that typeof(null) === 'object' because of a 20 year-old bug, but I consider the stability that comes from the "don't break the web" principle to be more than worth a few small annoyances like this.
If more of the industry followed this approach the world would be a better place.
This would NOT have been a breaking language change; the problem was introduced by a library that overrides a BUILTIN PROTOTYPE. Let's hope no library (or userspace code) overrides the "flat" method as well.
Overriding other people's code, especially core languages parts, is inherently risky from an API stability POV. I don't think all users appreciate such risk.
The answer, of course, is that we didn't realize it was a bad practice at the time and there's a bunch of legacy code around that uses the misfeature. If the JS community doesn't want to support this paradigm anymore, they should do it explicitly and lock the builtins from being changed in user code. Until then, we should treat it like the valid approach it is.
By the way, Javascript was designed in two weeks. I doubt a lot of thought went into such specific details. And the fact that the language doesn't prevent it doesn't make it a good idea - otherwise I'd claim that UB in C is a good idea.
It does seem to me like a more elegant solution, and perhaps what the behaviour should have been in the first place.
No, it's about `Array.prototype.flatten`
Apis do this all the time, why can't JavaScript of backwards compatibility is this important?
Of course, you could implement a static flatten, but it goes against the grain of all the other instance methods (map, reduce, filter, etc.). Considering how often they are chained together, it would be especially weird.
[1,2,[3,4,5]]
|> Array.flatten()
|> Array.filter((x) => x % 2 === 0)
|> Array.map((x) => x * 2)
|> Array.reduce((acc, x) => acc + x)
[0]: https://github.com/tc39/proposal-pipeline-operatorThe programming language will be around for a really long time. Little tools come and go. Never rename things in your language just to accomodate some little tool. There are millions of little tools. There are simply not enough synonyms available to accomodate them all.
The only sensible choice is to stand up for yourself and name things the right way in the language itself. The library will come out with a patch next week.
Here's a link to the last time they caved on the exact same type of issue, to the same silly library, a couple weeks ago:
"Might makes right" is rarely a good choice, not even for programming languages.
We're talking about MooTools, the library hardly anybody uses today and to 5 significant figures nobody will use 15 years from now. (It's 11 years old today).
The important point is that this will teach new libraries not to make the same mistake as this old one. That is, if you're going to add things to the standard library, first check to ensure you're not clobbering anything that gets added later.
Are you kidding me? Overwriting prototype is a widespread design pattern. Either ECMA ships the next version making it impossible (and breaking significantly larger parts of the web) or they shut up and accept that this mess is fully theirs. They designed themselves into a corner where developing without breaking user space is hard, they did that, and then they failed, they did that.
Last release was more than two years ago. It's time to move on.
How come that user code of any kind gets to override a builtin prototype, and that people are happy with that?
Would it be THAT bad to create a "mootools.Arrays" object with a "flatten" function? I think that either you've got a way to do such language extensions in a narrow scope (I think Ruby modules can do that, but I should check) so that they don't influence the whole app, or you simply shouldn't do that, period. Crazy interactions are hidden everywhere, otherwise.
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Inhe...
"One misfeature that is often used is to extend Object.prototype or one of the other built-in prototypes."
So what is to be done here?
How about leave it up to Mootools to release a new version that is compatible and the website owners can adjust their code accordingly.
an unmaintained website is likely already cracked.
It is tc39's job to add js features without breaking websites, however likely they are to be compromised.
So while I don't necessarily agree with the decision I completely understand it, their motivation is very noble. And again, it's not that big of a deal as a one off decision.