Hacker News new | ask | show | jobs
by marcyb5st 756 days ago
With all the language features I agree.

However, if you reduce the language surface it is possible to have something safe and simple enough (IMHO).

For instance, you can say no async, no custom traits and only {Debug, Display, Eq, PartialEq, ...} are allowed for your structs and generics. From limited personal experience that takes away more than half of the complexity of navigating rust code.

1 comments

The more you take away, the closer you are to a simple but unsafe language. If you remove the "unsafe" keyword, many things you can't solve easily nor optimally.

You might be able to outsource some complexity to external libraries, but integrating libraries is itself a major headache, and it can lead to security issues too.

Fair enough. But unsafe for kernel code I guess it's a necessary evil (that's why I didn't mention it).

However, I believe the being "opt-in" by explicitly marking sections unsafe is the way to go instead of having unsafe by default (which is the only way using C).

Unsafe is a daunting language feature, but ultimately it’s a feature. You’re meant to use it if you need it.

You don’t need to outsource complexity anywhere. Rust is fully capable.