
What if we had a great standard library in JavaScript? - hccampos
https://medium.com/@thomasfuchs/what-if-we-had-a-great-standard-library-in-javascript-52692342ee3f#.tcdwl9bu6
======
slang800
> Guess what? In the real world, this model quickly leads to a multitude of
> issues. The most obvious example is that if a package is removed for any
> reason, chaos quickly spreads... That’s actually not the main problem
> though.

Not only is that not the main problem, that has nothing to do with the use of
small components. The issue with removal of packages is caused by not having
an immutable package repository, which is actually pretty easy to fix with a
system like IPFS.

> A standard library could easily be added to JavaScript without years of
> committee infighting, stalled projects and failed approaches (remember the
> bat-shit craziness of E4X?). ES6 took 6 years to finalize and browsers to
> this day still don’t fully support it. There are plenty of successful and
> widely used libraries to draw inspiration (and implementation) for a first
> round from, like Underscore.js (and it’s predecessor in spirit,
> Prototype.js).

Since we already have underscore, backbone, express, bluebird, and all these
other libraries, why would we want to end the competition by pulling them into
the core and having to support them in a backwards-compatible way for years to
come? These libraries basically are JavaScript's "standard library"... they
just happen to be optional.

~~~
lollipop25
> These libraries basically are JavaScript's "standard library"... they just
> happen to be optional.

Optional is great and I'm siding on building APIs on the user-land side if
possible.

Unfortunately, having n different libraries basically doing the same thing is
just annoying. This thing you call "competition" is just developers egos gone
berserk. There's no point in building 2 things that do the same thing, unless
it's definitely better (which is good) or unless the point it conveys is "I'm
better than you" (which most devs are, really). I mean look at this guy who
tries to overtake jQuery 10 years after jQuery started:
[https://github.com/drduan/minggeJS/blob/pr/95/README_en.md](https://github.com/drduan/minggeJS/blob/pr/95/README_en.md)

That said, Lodash and Underscore should just merge. Zepto and jQuery should
just merge. Immutable and Mori should just merge. Inferno and React should
just merge.

------
takno
The real problem is that these APIs don't come easy, and given that JS didn't
bother to even start on this stuff until recently other languages have up to
25 years head start on JS. It doesn't help that the standards guys are just
playing around implementing stuff piecemeal, so you end up with Map and Set,
and the literally useless WeakSet, rather than just building a solid
collections framework, or service workers where as soon as a feature is
implemented in all browsers it gets deprecated because something shinier comes
along.

Even the stuff that is announced is horribly documented to the extent that
most people will never discover it or figure out how to use it. W3Schools
hangs around at the top of search results like an unusually stupid cancer,
chrome document nothing, and MDN does okay but is weak on tutorial and has
some awkward holes.

------
robrichard
I think this article ignores that JavaScript's standard library has been
growing in pace with new language features. The author mentions underscore as
a good place to draw inspiration, but a ton of it's functionality has already
been added to the language. forEach, map, reduce, filter, every, some, and
others were added in ES5. ES6 brings find, includes, isArray, Object.assign
and others. Promises were also added, make a library for them now unnecessary.
Many of the current proposals aren't just for syntax additions to language,
but to implement more standard library type of stuff (including string
padding).

