SmooshGate (2021)
developer.chrome.com
developer.chrome.com
It made the decision to extend prototypes. In hindsight, a huge mistake. At the time, almost nothing in JavaScript had changed in over a decade, it seemed safe, an unmoving target.
Douglas Crockford really doesn't get enough credit for the work he did getting ECMAScript into a living standard again. How soon people forget, but in the mid-aughts any mention of JavaScript was followed by a scoff.
Anyway, JavaScript shouldn't be trying specifically not to break MooTools. MooTools was trying to fix JavaScript.
I think it was a mistake at the time, but I still believe prototypal inheritance is pretty great idea. And JS desperately needs standard library, which IMO should extend built-in prototypes, so the language would be more coherent. ES1995 [0] was a funny take on this direction, but people (mainly non-JS people) would like to seriously use it. Go figure.
One thing I never understood about this problem: Why not change the behavior so that overriding non-enumerable properties makes them enumerable? That seems to be the behavior that library developers (e.g. MooTools) were already expecting anyway.
Basically, anything they could do here is a behavior change for someone. So, if they insist on not breaking things for anyone, the only option they have available (short of moving towards Windows-style app-specific compatibility workarounds) is to not change anything here, and just use a different name for the new method.
If assigning a value to a property that was previously defined as non-enumerable were to make it enumerable, then the very act of defining a property would have no value, except in the case where you are making a read-only property (ie using the "writable: false" option for Object.defineProperty).
As determined by whom, with what criteria and what methodology?
> or how ludicrous the reason for the breakage is
This behavior in MooTools (and Prototype.js and probably others) of monkey-patching built-ins was widely considered ludicrous at the same time as they were widely used across huge chunks of the web.
A more recent example: I consider real world use of alert to be ludicrous for nearly every usage I can imagine, and I hate when I interact with its usage even for benign things, but when Google tried to remove it from Chrome I objected along with a lot of others who have no personal love for alert itself. I opposed its removal because alert has certain guarantees, and removing it would break an untold number of sites in totally unpredictable ways. There are a bunch of “why don’t you just…?”-type suggestions in other comments, but the fact is you can’t “just” substitute anything for alert without recreating all the things people hate about it.
> I’d like to hear more details about how these decisions are actually made.
They discuss some of that in the article, but if you want more detail there’s a ton of public record in the various TC39 repos on GitHub[1], including repos detailing their process as well as per-proposal repos demonstrating application of their process. If you’re particularly interested, you’re in for a lot of good reading.
At least in the array grouping proposal, they did evaluate amount and popularity of possibly breaking sites, before eventually renaming the method from .groupBy to .group
I wish Chrome devs did. They have been actively breaking the Web on multiple occasions. Just try to launch some unmaintained HTML5 game from a few years ago and watch it trip over a non-working audio context. They reverted their window.alert change after deploying it only because the resulting breakage was too big to ignore. "Don't break the Web" is a myth, it's actually "don't break the Web so much that the user will notice enough things stopping to work after browser update to blame it on the browser".
In particular, given that Javascript predates App Stores by many years (I would hazard an unresearched guess at over a decade), and that Javascript serves myriad purposes in websites that have nothing to do with apps, this assertion requires extraordinary justification.
No, and that’s not what’s happening here. MooTools was very popular and is still used on many websites.
They are adding ‘flat’ even though in some obscure corner of the internet that’s going to break something.
It seems less flaky anyway, compared to relying on this subtle enumerability property.
https://github.com/tc39/proposal-flatMap/pull/56
https://twitter.com/bterlson/status/971210573818904576
https://twitter.com/BenLesh/status/971462667322839040
https://twitter.com/andrestaltz/status/971500672620351494
It's probably not worth engaging in these threads, since everyone now knows it was a joke, but Twitter doesn't put old things into read-only model unfortunately.
1. It sounds like there was confusion for a period of time because the developer made a joke. I think there really should be a specification for how to annotate humorous comments made on the web.
2. I loved the section spelling out the principle of "don't break the web." This is important, and as we get more and more legacy web the more valuable this principle becomes. That said, I wonder if a day is coming where the browser is disrupted because browser devs are moving too slowly on account of this.
Please note: #1 is a joke
The specification exists, it's just not enforced. If Google and Meta aren't going to step up, I think we should prosecute non-compliance with the full weight of the legal system. This is an existential threat to our society.
User "aerovistae" has been flagged for non-compliance.
(I know you're joking but...)
Humor relies fundamentally on shared context, and the Internet destroys that shared context.
https://en.wikipedia.org/wiki/Context_collapse
I guess the problem is when an in-joke is unexpectedly leaked to an out-group.
I've had to re-do so many things that were working when I shipped them but stopped because Chrome or Firefox or Safari changed something and broke it.
Heck, you can find probably 100s of examples of pages that no longer work because browsers changed things right here
https://experiments.withgoogle.com/collection/chrome
At the same time, the reason Safari doesn't report MacOS 11 is because too many sites had poorly written detectors that threw exceptions if they didn't see Mac OS 10_???? in the UA string. Here's the userAgent on Safari
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.0 Safari/605.1.15
Even though I'm on MacOS 12.6 on an M1 MacBookPro.
So there's at least one more example of "don't break the web'
Scott Fahlman is way ahead of you - in 1982 he proposed [1] an annotation for "attempted humor" - colon-hyphen-right bracket
[1] https://en.wikipedia.org/w/index.php?title=Emoticon&oldid=11...
In addition, having non-joke annotations helps people identify when a person is being dead serious. Even here on hackernews, Poe’s Law reigns supreme as people struggle to differentiate parody from genuine opinions.
Semantic web with an ontologically complete markup is not a joke and don’t confuse “Web 3.0” with “Web3”
Apparently it was just fine to break the web when it meant shutting off Flash and breaking millions of existing games and movies - but a few old sites that could trivially be wrapped that use Mootools are somehow good enough to change "flatten" to "flat"?
Lets code dynamically change things that other code depends on. Including behavior in built-in object prototypes.
Has weird properties like "enumerable" on members of those prototypes, so that changing a property doesn't do the same thing as adding one... but the API for both is the same.
It's like the language is built to cause breaking changes. "Don't break the Web" indeed.
The root cause here is writing millions of lines of code in something that was originally just supposed to validate forms.
Not exactly uncommon for languages that feature reflection.
Heck the win32 api allows you to hook and intercept function calls. So do plenty of other native C and C++ APIs.
It is a powerful feature that allows for a lot of functionality, including extending out libraries and fixing bugs in SDKs that you'd otherwise have to wait an entire release cycle for, or that may never get fixed. (And release cycles used to be years long!)
Can we have WASI DOM access etc soon please?
Even node 10 applications that use MooTools (i.e. JavaScript executing in a different runtime) will continue to work just fine if `flatten` is added as proposed in node 11+. The developers will eventually need to patch it but it's not like this bug where one day users autoupdate their browser and half the websites they visit are broken.
My white whale: make “let” mean what “const” means, and “var” mean what “let” currently means. But there are definitely better things to get done
I’m for keeping things working generally of course. People being against “don’t break the web” is a bit odd to me. But we are long overdue for versioning so we can actually fix stuff, especially given how much modern code goes through transpilers and the like
The trend seemed to be in the opposite direction. In the early days, you could use the language attribute of the script tag to specify a version, e.g. language="JavaScript1.2". But that failed to become a standard.
HTML used to be versioned by the DOCTYPE, but that fell out of favor with HTML5.
It's not exactly obscure.
Similar to "* { box-sizing: border-box; }" has become standard.
If they can't add an official .flatten for backwards compatibility now, we can assume they never will, right?
a) didn't know how to recognize a cheeky straw man proposal
b) didn't know how to take a joke
c) didn't agree with (or understand the importance of) the never-break-the-web imperative that TC39 operates under (turns out this is a lot of people)
tried to do exactly this to "prevent smoosh":
- https://github.com/staltz/prevent-smoosh
- https://twitter.com/andrestaltz/status/971500672620351494
Mostly, though, they just taught TC39 to have less fun and to ignore the "just break the web it's okay!" crowd.
Why TC39 operates under this never-break-the-web imperative: because if they didn't, every proposal they consider might devolve into an unresolvable discussion of "well is THIS thing important enough to break the web over? how much usage would this change break? how valuable do we think this is?". The easiest, and only, way to resolve all possible such discussions is to just not have them.
I absolutely love the ability to monkey patch in upcoming features. But I avoid adding my own array functions. Unfortunate, IMO, because it’s a really neat trick.
```js
// moduleA.js
Object.defineProperty(Array, "flatten", ...)
export Array
// moduleB.js
import { Array } from "moduleA"
console.log([[1],[2]].flatten())
```
What's really going on is that the MooTools dev is prob. friends with someone with influence on the committee.