4 ms·
>>Ada doesn't have smart pointers out of the box I am a novice-intermediate Ada user (and I started with SPARK before moving to just Ada), but a lot of the arg
by eggy 3y ago
>>Ada doesn't have smart pointers out of the box
I am a novice-intermediate Ada user (and I started with SPARK before moving to just Ada), but a lot of the arguments in favor of Rust mention that "there is a crate for that". I would say you need to compare vanilla Rust "out-of-the-box" with Ada for a fair comparison.
Another reason I prefer Ada is because I find it boringly simple like Pascal even though it is verbose, whereas I find Rust very obtuse, and I have a personal bias for array languages and ML languages. I wish Rust were more F#-like.
- masklinn 3y ago> but a lot of the arguments in favor of Rust mention that "there is a crate for that". I would say you need to compare vanilla Rust "out-of-the-box" with Ada for a fair comparison. Smart pointers are vanilla rust shrug. But also, it's pretty fair to mention the availability of crates, because they're easy to integrate, liberally used by the project itself (go browse https://github.com/rust-lang https://github.com/rust-lang and you'll see a number of projects for libraries distributed as crates rather than part of the stdlib), and there's a large breadth of available packages. The internet tells me Alire is a (the?) package manager for Ada, its listing has 373 entries right now (https://alire.ada.dev/crates.html https://alire.ada.dev/crates.html). Simple odds say you're more likely to find a crate for that than an ada package.
- worik 3y ago> But also, it's pretty fair to mention the availability of crates, because they're easy to integrate, liberally used by the project itself Yes This is a strength and a weakness in Rust The crate ecosystem is broad an deep. It is seemless to integrate crates if you are connected to the internet. That is a strength But it is also a weaknesses. "seemless to integrate crates if you are connected to the internet" but of unknown provenance and varying quality. There are steps you can take, tools you can use to ameliorate the issue, but it is a real danger It depends what you are working on. For systems which must be secure and reliable -weapons, flight control, banking, maybe Ada is a better choice For me I make musical instruments, and I will stick with Rust for that I know Rust, not Ada. A very interesting discussion for me to
- codys 3y agoFor the case of "smart pointers", and the larger point of "safety": rust has that included out of the box: Box, Rc, Arc, RefCell are all smart pointers included in the standard library. On safety of the language: the borrow checker exists, move semantics are the default (ie: included in the language) and copy is explicit, and real programs that isolate unsafety effectively (ie: so it doesn't need to be known outside of the module it exists in) are common.
- kaba0 3y agoBasically unique_ptr is the default in Rust. I also like to say that Rust is “just” the compile-time enforcement of C++’s smart pointers, which is technically not 100% correct, but gives a good mental image for the uninitiated, I guess.
- codys 3y agoedit: actually not RefCell. That's more Mutex like. Which is another place rust solves: the tooling for eliminating data races at compile time is mature and pretty complete. The race elimination in Ada appears to rely on using SPARK (as noted elsewhere: not universally used from others experiences), but I'm not too familiar, possible I'm wrong there.