Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

[flagged]


Unsafe doesn't operate on that scope, and it's not about the language primitives but the features that let you to ensure things about their usage.

Something I've just realized recently is that while not all Rust programs are safe and sane, Rust is one of the few langages with a type system powerful enough that you can actually specify and build safe and sane programs with it.

Languages like C/C++ and friends don't have more inherently dangerous primitives they just lack that type system. Same floor, lower ceiling.


It's not just the type system either. It also helps that rust has a great ecosystem of tools that catch all kinds of errors at build time. The compiler and clippy together genuinely do prevent a lot of mistakes.

This is a big part of why people often say "if it compiles, it works" in rust.


You people seem to underestimate the average sloppy programmer. Rust is yet composed of people that take programming seriously. One day it will be as popular as C++ or Java, and will you start seeing wonders in code bases around the world.

I've seen it before with Java. That thing was pure OO, contained in a VM with GC, perfect world. Poor guy that has to maintain Java legacy code these days. Right, right, this time is different.


Rust is already popular and old enough to have terrible Enterprise Rust code bases.

There are a few things working in Rust's favor:

* unsafe code is used to build safe abstractions around it, so most users don't have to write unsafe code themselves. It is easy to forbid use of unsafe blocks in your own codebase. You can flag unsafe code during code reviews, and have a policy who is allowed to write unsafe code.

* Rust leans on open-source dependencies a lot. Commonly used libraries are decent, since the community can band together to improve or replace them. This makes Rust applications mostly "glue" code, where there's less room to mess up in novel ways.

* the language allows defining strict library APIs which are harder to misuse. There's Clippy checking for common mistakes and sloppy code.

Rust already assumes that it will be written by less than prefect programmers.



> I could bet that most of these "new Rust safe programs" will start like this: unsafe { // your code goes here }

I'll take your bet. Most Rust program I've seen don't use unsafe or when they do, it is fairly limited in scope.


One step further, many rust libs use `#![forbid(unsafe_code)]` to explicitly disallow any unsafe. The rust community really likes that sort of thing, and for good reason.


Rust is not widely adopted yet. When the mass of sloppy programmers are required to write code (applications, drivers, etc.) in Rust, you will take the bet back.


I disagree. Rust is more widely adopted than you think, more so in mission critical software. Every major player uses it. It runs on embedded, Android, iOS, in your browser, it’s in the Linux kernel. Things will just be accelerating from here.


Rust in Linux kernel is a bold statement. It's a PoC, nothing relevant is implement in it yet.


You have no idea what you’re talking about. Unsafe doesn’t work this way.


> I could bet that

Chance of winning on betting is usually pretty small.




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: