Hacker News new | ask | show | jobs
by spauldo 794 days ago
My guess? There have been a few high profile security CVEs lately and the "why are we still using C" crowd is louder than usual. Ada's a viable alternative for performant system code, and it's kind of the underdog to Rust.
1 comments

Ada is not memory safe language tho, while it might make it a bit harder to introduce those bugs.
Ada is memory safe if you just work with the stack or avoid Unchecked_Deallocation. Since functions can allocate and return entire arrays and other data structures completely on the stack, you don't need to mess with the heap that often (and when you do, you can also define your own memory pools).

If you have to use dynamic allocation, you could also use the built in container libraries or controlled types for additional safety.

Though if you want the kind of memory safety that Rust has, there's always SPARK (a subset of Ada).

Is there a free version of SPARK? Proven correct code appeals to me, but I don't enjoy trying to get anything past purchasing.
SPARK is free by default, and readily available. You can use it as-is in ada by adding " with SPARK_Mode => On" to your code; here's some examples: https://learn.adacore.com/courses/intro-to-spark/chapters/01...

You can install gnatprove with alire via "alr install gnatprove"

It's been a while since I looked at SPARK and Ada, but the last time I did, SPARK was very well integrated with the GNAT Studio IDE.

I still preferred frama-c, because C, but it's a really nice toolchain.

Ada goes beyond memory safety.