Hacker News new | ask | show | jobs
by qsort 1317 days ago
Sic rebus stantibus, neither transition is realistic without enormous and painful investments.

Basically every single piece of software that matters is a C library or is exposed through a C API, because that's what other languages hook into, including Rust.

Heck, right this second I'm working on a piece of software that needs to talk to Java and Python simultaneously, so C++ with extern C it is.

Using memory safe languages when you can is good advice, but it's kind of complicated to get to a point where everything is guaranteed safe.

2 comments

> neither transition is realistic without enormous and painful investments

I don't disagree, and for that reason the transition will be slow, but I still think it will happen. The benefits are too great to ignore, or they eventually will be. Nobody's going to want to use insecure foundational libraries once secure ones are available. And they're already being written.

> Heck, right this second I'm working on a piece of software that needs to talk to Java and Python simultaneously, so C++ with extern C it is.

For what it's worth, Rust is entirely viable (and arguably easier than C++) in this space right now. It's also using extern C under the hood, but there are libraries like "pyo3" and "jni" which will deal with the unsafety for you and provide you with higher-level bindings. In practice you don't lost much safety using this approach.

Well, it could be written in Java, so Java-Java communication is trivial, and you could use something like protobuf to communicate between java-python. Or just some fixed binary layout.

Or even GraalVM which is polyglot between the two languages and can even optimize across language boundaries.