VM-Neutral Node.js API Unveiled, As NodeSource Collaborates With Microsoft, Mozilla, Intel and IBM (medium.com)
An anonymous reader writes:
This week saw the first proof of concept for Node.js API (or NAPI for short), "making module maintainers' lives easier by defining a stable module API that is independent from changes in [Google's JavaScript engine] V8 and allowing modules to run against newer versions of Node.js without recompilation." Their announcement cites both the efforts of the Node.js API working group and of ChakraCore, the core part of the Chakra Javascript engine that powers Microsoft Edge.
And there was also a second announcement -- that the Node.js build system "will start producing nightly node-chakracore builds, enabling Node.js to be used with the ChakraCore JavaScript engine. "These initial efforts are stepping stones to make Node.js VM-neutral, which would allow more opportunities for Node.js in IoT and mobile use cases as well as a variety of different systems."
One IBM runtime developer called it "a concrete step toward the strategic end goal of VM neutrality," and the Node.js Foundation believes that the API will ultimately result in "more modules to choose from, and more stability with modules without the need to continually upgrade."
And there was also a second announcement -- that the Node.js build system "will start producing nightly node-chakracore builds, enabling Node.js to be used with the ChakraCore JavaScript engine. "These initial efforts are stepping stones to make Node.js VM-neutral, which would allow more opportunities for Node.js in IoT and mobile use cases as well as a variety of different systems."
One IBM runtime developer called it "a concrete step toward the strategic end goal of VM neutrality," and the Node.js Foundation believes that the API will ultimately result in "more modules to choose from, and more stability with modules without the need to continually upgrade."
Step 2: remove a letter
??
Profit!!
Great times for web developers. With support for Jxcore, spidermonkey Chakra incl. Webassembly, Emscripten, nodejs will become a true multiplatform contender.
I keep hearing about this node.js thing but nobody has ever been able to clearly explain it to me: what the hell is it? Is that like that jQuery crap?
Who on earth would choose Javascript for server-side code?
nbind is a VM-neutral stable C++ / JavaScript API that already works across all versions of Node.js, Electron and recent evergreen web browsers. Binaries for Node.js and Electron can be compiled using GCC, Clang or Visual Studio targeting Linux, OS X or Windows. Asm.js binaries for browsers and Electron can be compiled using Emscripten. The API is the same in both cases, and work is ongoing to also provide a stable ABI across all versions of Node.js and Electron on a single platform.
Basically C++ classes and functions can be written using ordinary standard library types. Calling a special macro then invokes templates from nbind headers that autodetect argument and return types, handle type conversion and inform the JavaScript VM about the C++ API. nbind can also automatically generate TypeScript definitions.
Here's an example:
class VectorTest {
public:
static std::vector getInts() {
std::vector a {{ 13, 21, 34 }};
return(a);
}
};
NBIND_CLASS(VectorTest) {
method(getInts);
}
To call it from Node.js:
const addon = require('nbind').init().lib
console.log(addon.VectorTest.getInts());
The summary destroyed my hope that with IBM involved "VM-Neutral" might include VM/CMS...
Oh, really?
Beware Romulans baring gifts.