Skip to content

Comment on Returning to Nim from Python and Rustparent

Comments

All languages have memory unsafety somewhere in the stack.

This just makes no sense to me, then why try to replace C++? After all, all languages are memory unsafe.

Rust let’s you write unsafe code, that’s so different than say python.

Python lets you write unsafe code. https://wiki.python.org/moin/CrashingPython

Does that mean it's no safer than C++?

What? Those aren’t memory exploitable bugs.

And no I am not, you are saying that. I think python is way safer than either, you seem to think because you can crash a python program that means the memory vulnerabilities of rust are justified.

It's not just crashes. Python's ctypes API can do anything that unsafe Rust can do, including the parts that permit arbitrary code execution vulnerabilities.

Crashes are just security holes that nobody has crafted an exploit for yet.

GCs do various resource clean up that mean certain bugs are not exploitable. Rust does not have that.

And you didn’t address my second point.

GCs do various resource clean up that mean certain bugs are not exploitable. Rust does not have that.

All of the work Python does at runtime with a GC, Rust does at compile time with the borrow checker. GC is orthogonal to the idea of memory safety.

And you didn’t address my second point.

I don't know what you expect. It's a semantically empty statement and thus unfalsifiable. You can flip it around without changing the truth or the meaning:

you seem to think because you can crash a Rust program that means the memory vulnerabilities of Python are justified.

C++ is pervasively memory-unsafe; a bug in any part of a C++ codebase can easily cause undefined behavior, such that you can't isolate the memory-unsafe parts and apply extra assurance techniques to them. Most modern garbage-collected languages do let you do this, as does Rust.

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.