Ask HN: C with a Borrow-Checker

3 points by gypsyharlot ↗ HN
What would be the closest thing to C with Rust's borrow-checker? Imagine a memory-safe C that would enable "fearless concurrency", but without all the constantly moving advanced features of Rust.

I looked at Zig, but it doesn't have anything like the borrow-checker.

4 comments

[ 2.5 ms ] story [ 24.2 ms ] thread
How about Lisp? It is memory-safe and has fearless concurrency and you have not told anything about garbage collector. Long time ago it has been used for system programming (Lisp machines).

PS. I was expecting a link to a website but it is just "Ask HN" topic.

Sorry, I updated the title to reflect that this is a question. Specifically I was thinking about really high performance applications. I guess Lisp is maybe a good candidate for that.
Modern C++ with smart pointers and the synchronization primitives from its standard library.
Probably SPARK (programming language derived from Ada with advanced proof capabilities). The next release of SPARK will support pointer ownership similar to the Rust borrow checker:

https://blog.adacore.com/using-pointers-in-spark

https://arxiv.org/pdf/1710.07047.pdf

Concurrency in Ada is very easy. I haven't used SPARK enough to be familiar with its concurrency, but it looks very similar to Ada, but with added restrictions to allow for proofs:

https://docs.adacore.com/spark2014-docs/html/ug/en/source/co...