3 ms·
The purpose of my choosing python is that the comparison is essentially a category error. Python's semantics, and that of all GC'd interpreted languages, make m
by mjburgess 2y ago
The purpose of my choosing python is that the comparison is essentially a category error. Python's semantics, and that of all GC'd interpreted languages, make memory safety irrelevant.. there is no manual allocation of memory in the language.
I chose this example as I assumed it would be clear and non-controversial enough to make my point, ie., I assumed most HN readers would appreciate that a person claiming Rust's memory safety model made it safter than an interpreted language would be a person clearly deeply confused about the meaning of any of these terms.
- kenjackson 2y agoThere are still unsafe constructs possible in GC’ed languages. I think we’re conflating GC with memory safety.
- mjburgess 2y agoWell some GC'd languages can take pointers to memory (eg., C#) -- even actually CPython can since it has the cffi/etc. stuff to do so. In general though, GC means automatic memory management which is effectively a kind of dynamic memory safety.
- advael 2y agoThis is a great example of a common problem, which I've taken to calling "intent-solution conflation". Garbage collection is intended as a way to improve memory safety in a programming language. It doesn't fully accomplish this, and that's an important distinction This is often more apparent (though a rampant problem nonetheless!) in policy decisions. Like how KOSA is supposed to "protect kids online" but what it mostly does as written is train people to get their identities stolen while making websites even more cumbersome than they already are. If I think it's a dumb bill, someone might say "What, you don't want kids to be safe?", as that's actually a lot of the point of calling it that
- kstenerud 2y agoGoing on your original example "I heard rust was better than python because its safe", this would be a case where you ask: "What did the person who told you this say was safer in rust than in python?" If they don't know anything specific, then it's pretty safe to say "Well, there are some differences in the languages, and you might choose one over the other for performance or ecosystem reasons, but they're both pretty safe overall. You probably don't need to worry too much about it, TBH."