Choice quote:
There are many programming languages, and I believe in picking the right tool for the job. In the case of NeoPG, the priorities were:
- Support for strong cryptography.
- Compatibility with C application developers.
- Convert legacy code quickly.
- Tool support for QA.
Everything else is, at this point, a secondary concern. The Sequoia Project uses Rust, and I envy that. But the first thing they had to do was to wrap an existing C crypto library (they choose libnettle), because there is no high quality crypto library for Rust yet. That is their challenge.
My challenge will be to stay focussed on the parts of C++ that are actually helpful, and not get bogged down by the rest.
I know it's mostly semantics but calling C from C++ still requires some wrapping(extern "C", integrating build system, etc).
I've found with bindgen unless there's some crazy macro shenanigans going on it's actually quicker for me to integrate C libraries into Rust then wrangling CMake/Make/etc. The C FFI is very much a first-class citizen in Rust.
Even doubly so if we're talking about a cross-platform library.
A blog post on the decision to use an external library might be good. Is there a reason to think that the library will be better maintained than code with similar functionality in GPG?
Great work by the way! Thank you!
Comments like "couldn't they have used $niche-lang.org instead of [C++/Java/...]" bore me, to be honest.
I think C++ is not a great choice for complex crypto software because it doesn’t have very good safety-by-construction properties and it has to deal with (extremely) untrusted and probably malicious input. Parsers written in C or C++ are historically one of the biggest attack vectors out there.
I choose languages with tight control on memory for crypto-related stuff since you want to prevent leaks. You'll follow with a covert-channel analysis to be sure. If not crypto and stopping code injection, then a memory-safe language with interface checks and input validation will cover most problems. Those have been around since one was deployed in first, business mainframe: Burroughs B5000.
When I wrote it, though, I was mainly thinking of recent work that converts functional, verified specs into imperative specs that extracts to ML. I think that has a lot of potential for producing a pile of verified data structures with low cost similarly to the COGENT language that was used for ext2 filesystem. Got a link for Imperative/HOL-to-ML below.
We all know C++ is a valid design decision. We all know more hip languages have underdeveloped ecosystems. Yet opinions on which language to choose are not devoid of value because it indicates interest, sparks conversations, and may initiate development of the tools needed to make them less 'underdeveloped'.
The only thing we don't need is people saying another person's opinion is boring.
EDIT: Also, they said they were disappointed they used C++. Maybe they wished they stuck with C?
(Not an attack -- a genuine question because I'm interested in your choice and reasoning.)
Whatever value you assign to $LANG, you will always encounter a denizen on HackerNews that disparages $LANG and would've used $LANG-prime, but by not actually moving first to start a project to achieve that aim with the tool of their choice, they kind-of ceded their right to criticise.
That’s my point of view, at least: don't criticise the artist's choice of tools. It's rude.
C++ has an excellent C FFI :-)