News for hackers. Stuff that matters.
Re:Python 3.11.0 final is now available by brrrrrm on Tuesday October 25, 2022 @11:52AM (#33332261)
what about NAPI? Or deno/buns JITed api?

I’ve heard this “no C API” thing echoed by a couple people and it’s baffling. Do folks really think three major JS engines all written in C++ wouldn’t have an interface to interact with C?

Re:Python 3.11.0 final is now available by chubot on Tuesday October 25, 2022 @12:06PM (#33332466)
The problem is evolving the interpreter in a way that doesn't break bazillions of third party bindings -- Win32, OpenGL, Fortran for NumPy/Pandas, databases, GPUs, every C and C++ library ever, etc.

Python's C API exposes ref counting and the GIL. It's also very large

JS doesn't have that problem -- more code is written in pure JS, there are no C/C++ bindings in the browser.

There are C/C++ bindings in node.js for v8, but as far as I know they are discouraged and not used very much. The bindings are more "first party" in node.js than third party.

They have issues, but not the same ones as CPython, because the API is very different

JS VMs must be re-entrant because they're embedded in browsers. That was never the case for CPython

Re:Python 3.11.0 final is now available by brrrrrm on Tuesday October 25, 2022 @02:24PM (#33334333)
> as far as I know they are discouraged

Fwiw, this a fully stable and well documented API. It’s not even v8 exclusive, Bun cloned it for WebKit.

https://nodejs.org/api/n-api.html

Re:Python 3.11.0 final is now available by 323 on Tuesday October 25, 2022 @02:26PM (#33334362)
The only C code JavaScript needs to interact with is 100% under the control of the browser implementing that JavaScript engine.

JavaScript doesn't interact with random C libraries that the user might have, like Python does.

Re:Python 3.11.0 final is now available by brrrrrm on Tuesday October 25, 2022 @03:18PM (#33334948)
This is unfortunately a bit misinformed. You are thinking of a specific JavaScript implementation (browsers). The language has heavy adoption in the native space. Check out Node.js!

JavaScript does interact with random C libraries :)

Re:Python 3.11.0 final is now available by insanitybit on Tuesday October 25, 2022 @04:16PM (#33335567)
Yep, although for a very, very long time that wasn't the case.
Re:Python 3.11.0 final is now available by brrrrrm on Tuesday October 25, 2022 @05:08PM (#33336210)
Well, that changed over a decade ago
Re:Python 3.11.0 final is now available by insanitybit on Tuesday October 25, 2022 @05:45PM (#33336577)
But V8 and JIT'd runtimes were already standard for years by the time nodejs came out.