Comment by jt2190
11 years ago
Discoverability though is... poor seems like an argument for improving discoverability, not against having small modules.
11 years ago
Discoverability though is... poor seems like an argument for improving discoverability, not against having small modules.
Doesn't apply to Javascript, but something like Haskell's hoogle (stackage.org/hoogle could help with a small module approach. It lets you query for functions matching a certain type signature, like this: https://www.stackage.org/lts-5.9/hoogle?q=%5Ba%5D+-%3E+a+-%3...
Discoverability happens with standardization.
Why search through millions of unknown packages when a standard library would have it all right there?
Because the standard library is where modules go to die. Slaving the release cycle of a library to the release cycle of the language is bad for the health of that library, especially in the case of javascript where code often has to be written to run on old browsers with old versions of the standard library.
Now having a metalibrary that depends on a curated collection of popular/useful utilities is probably a good idea - but isn't that exactly what many of the libraries that broke due to depending on left-pad were?
I've wondered why the official committee doesn't have a recommended list of libraries for specific purposes.
That way I can get a curated list of great functions I can trust.
Essentially a standard library for all intents and purposes.
Yeah, I think the natural question here is: why doesn't TC39 round up all these basic packages and add them to the standard library? I've seen other languages criticized for having too large a standard library, but if this is the alternative...
left-pad was released under WTFPL, so in this particular case there'd be no legal barriers to it. (And I'd assume that, for any libraries with a restrictive enough license, it wouldn't be a hard sell on TC39's part -- if they put out an announcement that they were going to do that, I'd go panning for street cred, and I wouldn't be the only one.)
An alternative could be to pull all this stuff together into one big bucket of Legos and package it with a code analysis tool at the beginning of your build process to strip out everything you don't need from the bucket... but I'd guess that's either already been done or a stupid idea for reasons I don't know yet.
Its not about legal barriers, its about the incredible amount of work to precisely specify everything, which is required for any web standard.