If you want to get out of this dependency hell, bundle these small, essential functions into the runtime.
If you want to get out of this dependency hell, bundle these small, essential functions into the runtime.
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...
IMO the problem with npm is that it makes no distinction between snippets, libraries, frameworks and scripted command line tools. An npm package can be any of these. I feel there perhaps should be separate namespaces and package managers for all four — e.g. an inlining minimal “node snippet manager”, a standardized framework installer for things like create-react-app, and so on.
If you hand me a .framework and a .app for macOS, it’s immediately clear which is which. This isn’t an unreasonable standard for distributing programs.
In JS land, you have multiple different implementations with different feature sets and behaviors. Code written for V8/chrome/node may behave differently in safari/jscore or IE/edge/chakra or firefox/spidermonkey.
C++ has a lot of different standards, compilers and implementations. There are differences in vc++ and gcc that can prevent compilation without flags or custom implementations. But I am sure that simple functions like printf or strcpy behave same across implementations.
Even in Java you have Oracle JVM and android's custom dalvik/ART. But the standard Java functions still work the same. Same with .net/mono.
Although for this particular strawman I think `foo.constructor === Array` is probably enough.
I wish. See the `Set` implementation [1], for instance. It's lacking very basic stuff like union and intersection, forcing the user to copy/paste code or add another dependency.
Does someone know why they do that? Looking from the outside it seems that the committee in charge of this doesn't know what they're doing.
[1]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...
I think the “Why” is because it’s easier to get everyone to sign off on small changes than large changes that can never be removed.
The web platform has to live for a long time and be backwards compatible.
http://2ality.com/2015/01/es6-set-operations.html
> Long-term, I expect JavaScript to have built-in functionality for this, e.g. via functions that operate on iterables
A flat system would mean there’s only ever a single version installed. Or at least, I think that’s what OP means, since that’s the only definition I’ve ever heard.
Which is.. kind of surprising, I didn't realize that.
I sort of expected WebAssembly to have a performant JS API, since its origin is in asm.js, which was a peformant subset of javascript - but I see now that asm.js too had this same problem.
Which again surprises me, as I sort of expected it to be a bit like Macromedia Flash, which I recall had a Javascript API that seemed to perform well enough, although I suspect it wasn't used for high-performance scenarios, so maybe not.
It seems odd to me that the interfacing between these two technologies would be so separate that it would cause performance issues.. why would it not be something that is improved? Perhaps you'll have a flip where you write javascript and some other language, and the javascript runs as an interpreted language on the same VM with some compiled code, together...
Hmm.. an interpreted language interfacing with compiled bytecode efficiently... Python.. LISP can do it.. why not Javascript/WebAssembly?