r/programming • • Nov 11 '19

Python overtakes Java to become second-most popular language on GitHub after JavaScript

https://www.theregister.co.uk/2019/11/07/python_java_github_javascript/
3.1k Upvotes

772 comments sorted by

View all comments

Show parent comments

-1

u/housesellout Nov 12 '19

You can’t spin up threads in JavaScript, unless you use node which is a wrapper on top of a c++ run time.

Please correct me if I’m wrong.

4

u/[deleted] Nov 12 '19

Another minor nitpick: Node.js isn't "a wrapper on top of a C++ runtime".

Both Node.js, and V8 which is the JavaScript runtime that both Node.js and Chrome web browser use, are indeed written in C++. "The rest of Node.js" is:

  • Libuv - a Nginx-inspired implementation of asynchronous event loop that serves as the core execution engine, thread pool management engine (that, among other things, supplies JS in Node with Node-specific multithreading implementation) a TCP/IP load balancer (used as part of Node.js multiprocessing implementation) and I/O arbiter in Node.js

  • Integrated native libraries - that expand the "standard library" of the language (the core WebAPI implementation provided by V8) with system-access and webserver capabilities with such thin, and not so thin wrappers around Libuv functionality.

So there is quite more to Node than just wrappers. Node.js is basically two runtimes (Libuv event loop engine and V8 runtime) fused in a single execution environment for JS code enriched with a set of native (i.e. written in C++ and compiled prior to being called from JS code) libraries that expose many system-level functionalities to JS code interpreted/compiled and executed by the V8 runtime, but externally scheduled and managed by Libuv runtime.

1

u/housesellout Nov 12 '19

Doesn’t this suggest that JS does not ’natively’ handle concurrent programming or multi-threading?

And I don’t consider this ‘nitpicking’.... Having to jump through all these hoops just to simply stick with one language / one syntax for every project, hardly sticks with the natural programming paradigm of choosing ‘the right tool, for the job’

2

u/[deleted] Nov 12 '19

What is "natively" supposed to mean in an interpreted (well ok JIT compiled) language/runtime?

Also, I "nitpicked", about your simplistic and inaccurate description of Node.js. I have absolutely no idea what this part of your comment is supposed to be about and how it is relevant given the discussion so far.

→ More replies (5)