5 ms·
Lets put it this way. Rust is great and all for somebody who is willing to invest in it but there are simply other "mature" alternatives that are just as good.
by honest_joe 11y ago
Lets put it this way. Rust is great and all for somebody who is willing to invest in it but there are simply other "mature" alternatives that are just as good.
- Jweb_Guru 11y agoCan you describe for me the alternatives to Rust that are memory safe without mandatory garbage collection and allow safe deallocation? The only industry language I'm aware of that meets these criteria and isn't a full-fledged theorem prover is ATS, and to call it a "mature alternative that is just as good" is kind of laughable.
- SamReidHughes 11y agoRust isn't memory safe. You have to use unsafe blocks to do a lot of useful stuff.
- EugeneOZ 11y agoYou don't have to. Example: https://github.com/iron/iron/ https://github.com/iron/iron/
- Jweb_Guru 11y agoRust is only not memory safe in the same sense that any language with C FFI or a runtime written in C++ that isn't formally verified isn't memory safe. Which basically includes every language.
- SamReidHughes 11y agoYou said garbage collection. You can't make whatever data structures in Rust that you want, without unsafe blocks or garbage collection (or no deallocation).
- Jweb_Guru 11y agoI didn't say "you can make any data structure you want without unsafe blocks or garbage collection." I said that you can write safe Rust without mandatory garbage collection and with deallocation. You're responding to a point I didn't make. In any case, part of the point of Rust is the ability to write safe abstractions over unsafe code. Arguing that the data structures like vectors are not memory safe is identical to the argument that other languages' runtimes are not safe.
- SamReidHughes 11y ago> I didn't say "you can make any data structure you want without unsafe blocks or garbage collection." I didn't say you said that, I gave an example of a useful thing you can't do in Rust. It is very meaningful to say that Rust isn't practically memory safe if you have to resort to unsafe code a lot of the time, or pay performance costs. I'm not talking about data structures like vectors, by the way. And it's not just data structures themselves, it's what you can do with them on the outside. Obviously you can make pretty much whatever abstractions you want in Rust if you use some GC'd heap or allocate stuff in vectors and use indices instead of pointers. But if you're doing that, you're probably going to not be doing it for long, there's a reason you aren't using Java.
- Jweb_Guru 11y agoI don't disagree with you. I think Rust has a long way to go before it can practically match well-optimized C in many cases without unreasonable amounts of unsafe code (obviously, this is subjective). But it at least offers the possibility of doing so, which is much more than I can say for essentially any other language. And even in performance-critical, optimized-assembly-output code in Rust, a lot of it is safe already.
- kibwen 11y agoAt some level you have to talk to the OS to do IO and allocate memory. ATS needs escape hatches for these just as Rust does. And in languages that don't give you escape hatches, they just drop down to C to implement their garbage collector.
- Daishiman 11y agoThe number of unsafe lines of code used in Rust codebases is essentnially close to zero. unsafe is useful for library writers of very specific bit twiddling and memory management or very particular (and unsual) memory management tasks.
- kibwen 11y agoThe number of unsafe lines doesn't even matter, because the person you're responding to fails to understand that code can be memory-safe while containing code in `unsafe` blocks.
- kibwen 11y agoAnd Python uses to implement its basic data structures, so does that mean Python isn't memory safe? What languages are memory safe, by your definition?