top | item 16551638

Don't let TC39 use smoosh or smooshMap

14 points| voctor | 8 years ago |github.com

9 comments

order
[+] alexbanks|8 years ago|reply
> The purpose of this library is to prevent TC39 from adding Array.prototype.smoosh and Array.prototype.smooshMap as replacement names for Array.prototype.flatten and Array.prototype.flatMap. They usually don't listen to popular votes, but they do listen to the Web and usages of JavaScript in the wild. So here's your chance to vote with your code in production. Put this library in your production large-scale website (it's very tiny! won't hurt) and we'll have a compelling case for TC39 not to break backwards compatibility.

Why do I not want TC39 to use smoosh or smooshMap?

[+] jamesgeck0|8 years ago|reply
Perhaps you hate whimsy. Perhaps you desire consistency with other languages. Perhaps you don't care about breaking a ton of unmaintained websites.

`smoosh` is a perfectly fine and delightful method name, TBH.

[+] aspirin|8 years ago|reply
It's a form of protest. If both flatMap and smooshMap are seen as equally "breaking the web", maybe TC39 will coose the less insane name for the method.
[+] olliej|8 years ago|reply
Cool, go back and tell the library authors to stop putting bullshit on native objects, or get them to put namespace prefixes when they do. Don’t blame TC39 for doing their jobs: not breaking existing content.

Blame the authors of the frameworks that force js into a terrible corner

[+] TheCoelacanth|8 years ago|reply
If you do this they will just use some other ridiculous name like 'squash'. Instead you need to check for the presence of any other TC39 feature and then if any are present, break if flatten isn't present.
[+] cpburns2009|8 years ago|reply
What is TC39? And what is smoosh?
[+] WorldMaker|8 years ago|reply
Technical Committee 39 of ECMA [1] is the governing board for the living ECMAScript standards documents, which influence the direction of the language we more often call JavaScript.

There's a current TC39 proposal [2] (at Stage 3, which is the discovery stage to gauge feasibility in browsers) to add officially to the language standard `Array.prototype.flatten()` (to flatten an array like `[[1, 2], 3, [4, 5]]` to `[1, 2, 3, 4, 5]`) and `Array.prototype.flatMap` (to `flatten().map()` as a single operation).

Because browser vendors discovered some libraries in the wild (8+ year old versions of MooTools) install their own incompatible to the new spec version of `Array.prototype.flatten` that does something different from the array flattening above, there is a discussion (as PR) [3] to avoid breaking ancient websites by choosing a new name for the proposed `Array.prototype.flatten`, in the case of the PR `Array.prototype.smoosh`. (For consistency it then renames `Array.prototype.flatMap` to `Array.prototype.smooshMap`.)

Other names are being discussed as well in the PR, and the TC39 committee has not yet actually met on the subject at this time, so nothing is quite set in stone.

[1] https://github.com/tc39 [2] https://tc39.github.io/proposal-flatMap/ [3] https://github.com/tc39/proposal-flatMap/pull/56

[+] retrocat|8 years ago|reply
TC39 is the standard body for ECMAScript, which JavaScript implements. smoosh was a proposed alternative name (see: https://github.com/tc39/proposal-flatMap/pull/56) for flatten (and smooshMap for flatMap) due to incompatibilities with older libraries (namely, Mootools).