|
|
|
|
|
by fghgfdfg
3513 days ago
|
|
I completely disagree with those statements. Rust can give stronger static guarantees in simpler instances. When it comes to more complex cases, neither language can guarantee much. Ada however has better mechanisms for handling them safely. For example, you can specify a particular allocator for individual types rather than relying on each allocation to use the custom allocator. If you're outside the realm of the Rust borrow checker and want to use an arena to keep the memory side of things simple and safe, it's much easier to do properly in Ada. Ada is also significantly safer than C. Between the much stronger type system, memory safety facilities, bounds checking, non-nullable pointer types, generics, contracts etc. it's clearly a much safer option than C. |
|
Having a 1-to-1 correspondence between types and allocators screams of lack of separation of concerns. In any case...
> If you're outside the realm of the Rust borrow checker and want to use an arena to keep the memory side of things simple and safe, it's much easier to do properly in Ada.
Arenas can be given safe interfaces in Rust just fine: https://crates.io/search?q=arena
> memory safety facilities
The article literally says: “Tasks are awesome, but sometimes they're not quite what you want --- particularly as there's no protection against two tasks modifying the same variable at the same time.”
So much for memory safety.
> bounds checking
Implementable as a library feature. For example, in Standard ML:
There is no need to bloat the core language.> non-nullable pointer types
In an unusable way.
> generics
Parametric polymorphism buys you non-repetition, not safety.
> contracts
Contracts don't buy you safety. Your code will just crash at more predictable places when a contract assertion fails. But it will still crash. Hard.
Static analysis buys you safety.