3 ms·
> JS as the extension language Just to reinforce why it is a bad decision. One of the selling points of JS is that vast amount of libraries available to you. B
by PuercoPop 6y ago
> JS as the extension language
Just to reinforce why it is a bad decision. One of the selling points of JS is that vast amount of libraries available to you. But in GNOME's case they use spider-monkey as their JS engine, which means that although JS is the extension language not using node means _no_ npm (or node APIs like the fs module)
- est31 6y agoTBH that makes GNOME more attractive to me as it means that simplest apps only include the code that's needed instead of gazillions of dependencies.
- devwastaken 6y agoCopy+paste from the github repos of each package is hardly superior to just having package management. Node doesn't magically make every program bulky. Avoid authors that feel the need to include lots of bulky packages.
- est31 6y agoeven if you just do copy+paste you copy over less dependencies because there is a cost. Each time you wonder: is it worth it? Ideally you don't do it at all though. As for avoiding authors who bloat up your hard disk, it's easier done on a platform that puts stones into their way like GNME does.
- canofbars 6y agoCopy and paste makes the developer aware of how much they are dragging in. Its easy to run yarn add and then import millions of lines of code. If you tried to do that by hand you would stop and rethink if isOdd() actually requires that much code.
- devwastaken 6y agoV8 is superior in lots of other ways too. Interop with C is well defined and there's a lot of documentation. Overall integration is much better supported. Spider monkey has no purpose in existing anymore by comparison.
- PuercoPop 6y agoI wouldn't say it has no purpose existing, but it is the path less trodden so you'll run into more issues.
- moron4hire 6y agoWhat? There's lots of Node-independent code in NPM.
- PuercoPop 6y agoI doubt there is lots of JS code in NPM which is independent of either Node or browser APIs when including transitive dependencies. But that is besides the point. I said no NPM as in no access to NPM. Not just no node APIs. Let's say you install a library from npm using either npm or yarn. Its downloaded into the node_modules directory. how would you require it as an es6 module? Another poor design from the GNOME team. How is the JS code in the gnome extension distributed? It is embedded in .so files! so much for hackability. (I learned this when upon a fresh Ubuntu install I run into bug in my gnome shell version which was a one liner fix but I couldn't find the file in the backtrace.)
- cycloptic 6y agoI haven't tried this with any node modules but you should be able to set imports.searchPath to include your node_modules folder, at least for testing: https://gitlab.gnome.org/GNOME/gjs/-/blob/master/doc/Modules.md#more-about-imports https://gitlab.gnome.org/GNOME/gjs/-/blob/master/doc/Modules... Since there is no inbuilt support for Node APIs this will probably only work with modules that have no dependencies and are built into a single file. ES6 module support is WIP and ongoing: https://gitlab.gnome.org/GNOME/gjs/-/issues/328 https://gitlab.gnome.org/GNOME/gjs/-/issues/328
- na85 6y agoI wouldn't touch a desktop environment with a 10 foot pole if it used node or npm.