Live data from Hacker News

The choice between Rust and C-derived languages is not only about memory safety

bbuyukliev.blogspot.com

11–20 of 20 posts

Re: The choice between Rust and C-derived languages is not only about memory safety

#11

>None of this means Rust is "bad" or that C is "better". It means they optimise for different values. Rust optimises for correctness and maintainability under heavy abstraction. C optimises for transparency and minimalism under extreme constraints. >Sometimes you don't want a language that keeps you safe. Sometimes you want one that simply gets out of your way. D lang is a wonderful Goldilocks in this regard between…

I feel like D was gaining momentum and then stopped, and I’m unsure why.

I’ve read about competing RTLs etc but none of that really seems a blocker. Rust has changed an awful lot too since it’s early days.

Re: The choice between Rust and C-derived languages is not only about memory safety

#12

This looks like it was written by an LLM. Not complaining, because my major use of LLMs is rubber-ducking, not code-generation, and I very often get responses like this when doing repeated iterations and deep-diving into a review/comparison. The concepts are probably the authors, but the text we are seeing is probably the LLMs. Regardless of the LLM overtones, this is still decent content.

You are correct. The final output was polished by ChatGPT, but I originally presented the basic ideas in a few paragraphs. The LLM added a sense of flow and persuasiveness which are somehow lacking in my rather dry and non-native English writing style.

Re: The choice between Rust and C-derived languages is not only about memory safety

#13

>None of this means Rust is "bad" or that C is "better". It means they optimise for different values. Rust optimises for correctness and maintainability under heavy abstraction. C optimises for transparency and minimalism under extreme constraints. >Sometimes you don't want a language that keeps you safe. Sometimes you want one that simply gets out of your way. D lang is a wonderful Goldilocks in this regard between…

> UFCS

Uniform Function Call Syntax seems neat, but is it really uniform? In other words, can you call a random method defined on a class via method(class, parameters)? Or are some things more uniform than others?

Re: The choice between Rust and C-derived languages is not only about memory safety

#14
Yet another Rust article that ignores the choice among memory safe languages, including the ML linage that inspired Rust's type system.

The only reason to pick Rust instead of one of those, is exactly because the memory safety without GC that it offers, when any form of automatic resource management, be it in whatever form, is not possible, or welcomed by the domain experts.

Re: The choice between Rust and C-derived languages is not only about memory safety

#15

This looks like it was written by an LLM. Not complaining, because my major use of LLMs is rubber-ducking, not code-generation, and I very often get responses like this when doing repeated iterations and deep-diving into a review/comparison. The concepts are probably the authors, but the text we are seeing is probably the LLMs. Regardless of the LLM overtones, this is still decent content.

You are correct. The final output was polished by ChatGPT, but I originally presented the basic ideas in a few paragraphs. The LLM added a sense of flow and persuasiveness which are somehow lacking in my rather dry and non-native English writing style.

I feel you should avoid this.

Too many people, myself included, often skip LLM content.

After I am done rubberducking with the LLM I write my own code. I can you should do that too. Leave a few days after your session to let the discussion percolate in your mind, then write the post and only then check the discussion again to see if any details can be added.

In all fairness, I dont actually write blog posts like this, I just bang 'em out whenever I feel like, so not sure of it will work as well as I think it would.

Re: The choice between Rust and C-derived languages is not only about memory safety

#16
Okay, I like Rust, really... But, I totally agree it's not just about memory safety.

Rust gives you: Memory safety (mostly), No use-after-free, double-free, buffer overruns in safe Rust.

It does not give you: logic/protocol/cryptographic correctness, supply-chain integrity, side-channel resistance, malicious dependency immunity, auditability, reduced attack surface, or reduced complexity.

In other words, Rust solves one class of bugs extremely well. It solves none of the hard ones.

I get it, memory corruption bugs are Loud, measurable, easy to point at, and easy to sell to management.

That's why they dominate the narrative.

My biggest issue/concern is the dependency explosion problem.

Classic C Example: - ~N lines of code - A small number of carefully curated libraries - Mostly static linking - Painful to write - Painful to maintain - Possible to audit

Rust rewrite: - Core project + - 50 direct dependencies + - 300 transitive deps + - 900 crates total + - Thousands of maintainers you have never met + - GitHub accounts that may disappear tomorrow + - Build scripts executing arbitrary code at compile time

Security claim: "Memory safe!" Reality: Attack surface inflation by 1–2 orders of magnitude

You've traded: "I might screw up a pointer"

for: "I trust a thousand strangers, their CI pipelines, their update hygiene, their threat models, and their long-term incentives."

...

Rust’s memory-safety guarantees are genuinely valuable, especially for new development. Where I become skeptical is when a rewrite significantly expands the dependency graph. At that point, the security model shifts from "local reasoning enforced by the compiler" to "transitive trust in a very large supply chain". That trade-off isn't always acknowledged, and in some contexts, especially high-assurance systems, it deserves more scrutiny.

Re: The choice between Rust and C-derived languages is not only about memory safety

#17

Forget safety. Using enums in Rust is sheer delight. The fact they can even contain associated data is the really powerful. That alone makes me love the language. Especially with bitfields. It cannot be matched in in C, even with a lot of macro magic. Plus, C is way too lax with type strictness and enums.

That’s right. And forget about the existing rustc compiler implement. If you have something in Rust like let a: HashMap = immutable_map.iter().map(…); then you can infer from the semantics that the ordering doesn’t matter and whether it can be parallelized. C doesn’t have the ability to express what you want to happen, just how to do it. That gives Rust far more opportunity for optimization than C possibly can have.

C != C-derived languages

In C++ this was possible already in C++03.

OTOH, it wasn't until recently that you were able to write something like `std::array` in rust. Even now, there are restrictions on the kinds of expressions that N can be.

Just pointing out that this cuts both ways.

Re: The choice between Rust and C-derived languages is not only about memory safety

#18
post #14

Yet another Rust article that ignores the choice among memory safe languages, including the ML linage that inspired Rust's type system. The only reason to pick Rust instead of one of those, is exactly because the memory safety without GC that it offers, when any form of automatic resource management, be it in whatever form, is not possible, or welcomed by the domain experts.

Article is about C. So non-GC memory safe language, as first, choice makes sense here.

Re: The choice between Rust and C-derived languages is not only about memory safety

#19
post #18
post #14

Yet another Rust article that ignores the choice among memory safe languages, including the ML linage that inspired Rust's type system. The only reason to pick Rust instead of one of those, is exactly because the memory safety without GC that it offers, when any form of automatic resource management, be it in whatever form, is not possible, or welcomed by the domain experts.

Article is about C. So non-GC memory safe language, as first, choice makes sense here.

Not really, there are tons of software written in C that should have never came close to a C compiler in first place.

Even the UNIX and C authors agree with this, given what they worked on, in OS design and programming languages post C.

Something that many glance over, what have their UNIX idols actually done after UNIX System V.

Thus the first question already is that kernel code or not, and if not, why should it be written in C versus any other safer alternative.

Actual reasons like performance numbers required by the application, or existing SDK availability, not the "because I like it".

Re: The choice between Rust and C-derived languages is not only about memory safety

#20
post #14

Yet another Rust article that ignores the choice among memory safe languages, including the ML linage that inspired Rust's type system. The only reason to pick Rust instead of one of those, is exactly because the memory safety without GC that it offers, when any form of automatic resource management, be it in whatever form, is not possible, or welcomed by the domain experts.

In agreement, that this looks like a false dichotomy being presented to readers, C-derived versus Rust. First, Rust is usually considered or positioned as a C-family language, despite its ML connection. Second, in the context of C alternatives, there are many other memory-safe languages (Golang, Vlang, Dlang, etc...). Third, the context of when Rust is really needed (as a high-level language), is few.

Many of the high level features that Rust offers, outside of memory-safety, other C-family languages have too. And those other languages can have different advantages over Rust: easier to learn, easier to use, readability, compilation speed, etc... Very much a depends type of thing.

Post reply on HN