4 ms·
Would Ruby, Java, Go, and other gc’ed languages really be considered memory safe? I’d think you have to re-write the Ruby interpreter and the JVM in rust in ord
by jmarchello 3y ago
Would Ruby, Java, Go, and other gc’ed languages really be considered memory safe? I’d think you have to re-write the Ruby interpreter and the JVM in rust in order to achieve their stated goal here. Someone with deeper system’s knowledge please correct me if I’m wrong.
- deleted 3y ago[deleted]
- steveklabnik 3y agoYou’re wrong. All of these languages are considered memory safe.
- donkeybeer 3y agoHe's talking about the fact that many of these language and vm implementations are written in C and C++, and that C and C++ are supposedly to be avoided.
- steveklabnik 3y agoThat is not relevant to the question of “is this a memory safe language or not.” The language used as the implementation language does not dictate the semantics of the language being implemented, which is the thing being discussed.
- trealira 3y agoThose languages have safe interfaces (the programming languages themselves) over a runtime that has to use unsafe code at some point (e.g. to write the garbage collector). If that's not memory safe, then Rust wouldn't be considered safe either, because its standard library is built on unsafe code with safe interfaces, too.
- retrocryptid 3y agoRust isn't completely safe, it's just a lot safer than C. And it's unsuited for many roles because it has eschewed reverse compatibility. Sure, you can write an operating system in Rust, but you'll have to re-write it (and possibly introduce new bugs) in five years or so. I'm not the world's biggest C fan, but there are programs I wrote in the late 70s that still compile and do what you think they should do.
- tharne 3y ago> And it's unsuited for many roles because it has eschewed reverse compatibility. Sure, you can write an operating system in Rust, but you'll have to re-write it (and possibly introduce new bugs) in five years or so. That's okay. Most rust devs get an erection at the idea of rewriting a massive codebase. For them the required rewrite every 5 years is a feature, not a bug.
- masfoobar 3y ago^^ This. This is one of the good things about C. I could write something in C99 and, in 10 years, it will likely still compile without changes! Can we say this about Java, C#, D.. and ESPECIALLY Rust??? You might still be able to download the specific version, but you then have to cater to package manageers, or the IDE/editor you are using, etc. C does not try to cram in "Cool Feature A" and "Cool Feature B" because it is the cool thing of the time. I think the only other languages to come close is Odin and, perhaps, Zig. Both have not had a production release (yet) so I am still expecting there to be some changes at this point. However, once mature, I would expect very little changes if left for 10 years. Of course - they are young languages but Odin (especially) makes it very clear what they will and won't add to the language, and keeps it pretty close to C in a number of ways.
- trealira 3y ago> I could write something in C99 and, in 10 years, it will likely still compile without changes! Can we say this about Java, C#, D.. and ESPECIALLY Rust??? I think you could say this about Java. The others, I'm unsure about.
- Kuba4ful 3y agoC# dev here, you can compile applications from any time period very easily as long as you have the correct .NET SDK version, which is specified in the .csproj file. It's the same with Java, where to compile old applications you also need to use the same JDK version, however with Java it's a bit harder cause there is no file that says which JDK version should be used to compile this. At least I think so, correct me if I'm wrong.