4 ms·
I have little idea about cars (Java), but in carpet land (JS): we had the largest module ecosystem ever and it was pretty much ignored by TC39 in favor of a new
by nailer 10y ago
I have little idea about cars (Java), but in carpet land (JS): we had the largest module ecosystem ever and it was pretty much ignored by TC39 in favor of a new solution, which has technical benefits (it's async), but there's no migration path from the current standard to the new anointed 'standard'. Sometimes technical committees just refuse to pave cowpaths. Look at the amount of lines it takes to do an XHR in the 'fetch' API vs superagent in, say, 2012.
- chickenfries 10y agoWhat do you mean by cars and carpet?
- akoumis 10y agoThe poster is emphasizing that their knowledge stems from a completely different industry but similar circumstances might provide useful insights into the issue.
- bdcravens 10y agoAlso drawing distinction between Java and JavaScript naming, as they really aren't related aside from those first few letters.
- wyuenho 10y agoI'm very interested in what "largest module ecosystem" you were referring to and what you mean by "the amount of lines it takes to do an XHR in the 'fetch' API vs superagent in, say, 2012." AFAIK, there was a time when the "module ecosystems" were essentially split between requirejs (AMD) on the front and CJS in the back. Fetch is also not XHR, and has different security defaults and trade-offs.
- nailer 10y agoCommonJS (via npm) is used on more front-end code than TC39 modules are to this day. I should say 'HTTP request' rather than XHR but the point still stands: having different objectives doesn't make it OK to ignore mime types, have people manually encode JSON, have people manually encode query strings, and all the other things we already have now in fetch. Which nobody will use (unless they want to cancel requests) because we already have better solutions with less needless boilerplate.
- wyuenho 10y agoTC39 had been talking about JS modules for about decade, before CJS even existed. CJS is unsuitable on the frond end because it's synchronous and does not enable static analysis. CJS being more popular on the front end is a very recent phenomenon, it really started to take off when React took off. AngularJS had its own module system and everything jQuery were essentially AMD first. I also don't know what you are talking what we already have in fetch. It you are arguing WHATWG should have just adopted superagent, I disagree. The major difference between fetch and XHR is the ability to stream content. Fetch only needs to be better than XHR. Superagent uses XHR internally, and it's extremely difficult to have XHR support streaming without turning its API to an even bigger mess. Encoding JSON yourself is a one-liner in JS. Encoding query string is also easy, there's a whole new URL object to help you now. If not, it's just a tiny function away. It's not hard to wrap fetch at all.
- nailer 10y ago> TC39 had been talking about JS modules for about decade, before CJS even existed. Yep, which explains the ignorance. None of the other modules systems are a hundred thousandth the size of npm, so don't matter. > I also don't know what you are talking what we already have in fetch. Literally POST some JSON to a resource with a query and compare the code using superagent to the fetch API. > Encoding JSON yourself is a one-liner in JS. Encoding query string is also easy. That is irrelevant. Defaults should be sane.
- pcwalton 10y agoThe Node module system was not "ignored". The folks I know on TC39 talked about it constantly. "export default" was added specifically for compatibility with Node. They just didn't adopt it wholesale.