Brendan Eich: JavaScript standard library will stay small

JavaScript's standard library could eventually grow to reduce reliance on third-party packages -- but it'll happen slowly, says Eich

Brendan Eich: JavaScript standard library will stay small
Credit: flickr/Loughborough University Library

A recent incident where software was removed from the NPM package registry for Node.js -- aka "Left-pad-gate" -- has spurred a new round of conversation about the JavaScript ecosystem.

Aside from debates about users' dependence on NPM, the event once again raises another major question: whether or not JavaScript needs an expanded standard library of functions.

Many of the packages that briefly vanished from NPM, like left-pad itself, were small functions meant to provide JavaScript applications with several common behaviors. Given JavaScript's overall success and adoption, wouldn't it make sense to bundle many of the attributes into JavaScript itself? The short answer: It might happen in time, but oversight of the language slows the pace of such decisions.

According to JavaScript creator Brendan Eich -- who was also caught by surprise with the NPM incident-- the standard library that exists in JavaScript is kept intentionally small, because of the way JavaScript is maintained and evolved by committee.

"We’re careful not to add to [the standard library] because the easiest thing in the world is to make it too big," said Eich in a discussion with InfoWorld's Paul Krill.

Despite Eich's position as a major force in JavaScript, the language isn't maintained by "a single person or pair of people who design well like the founders of Unix were or the creators of Perl, Python, and Ruby are." Instead, "You have a bunch of people from different companies. They’d do a terrible job if they were in charge of building a big standard library."

When the standard library expands, it's due to elements in JavaScript becoming "so common they all work alike among the different flavors, that we just put them into the language over time."

"The real standard library people want," said Eich, "is more like what you find in Python or Ruby, and it's more batteries included, feature complete, and that is not in JavaScript. That’s in the NPM world or the larger world."

Thus, Eich envisions a highly controlled, incremental evolution for JavaScript's standard library. In time, pressure from issues like those stemming from left-pad may lead to the adoption of features into the core standard, but they must be "proven and widely used" first.

"We’re not trying to ... design by committee or get into religious wars among the different thinkers on how the standard library API should work," said Eich.

From CIO: 8 Free Online Courses to Grow Your Tech Skills