|
|
Subscribe / Log in / New account

"Trying to represent this API in Rust just doesn't work. The language never lets mutable references alias each other,"

"Trying to represent this API in Rust just doesn't work. The language never lets mutable references alias each other,"

Posted Oct 7, 2025 8:53 UTC (Tue) by roc (subscriber, #30627)
In reply to: "Trying to represent this API in Rust just doesn't work. The language never lets mutable references alias each other," by daroc
Parent article: Comparing Rust to Carbon

Or you could reshape the API on the C++ side before you move code to Rust.

This is a pretty weak motivation for Carbon IMHO.


to post comments

"Trying to represent this API in Rust just doesn't work. The language never lets mutable references alias each other,"

Posted Oct 8, 2025 2:04 UTC (Wed) by smurf (subscriber, #17840) [Link]

> Or you could reshape the API on the C++ side

That was my first thought too. I mean, the caller of this thing knows whether it's the same buffer or not. In-place modification in general allows for different optimizations than knowing that two regions don't alias.

IMHO the more apt comparison isn't greenfield vs. brownfield but, quite plainly, a culture where the C[++] users see the new kid on the block as an opportunity to clean up their own act i.e. their own interfaces, thus improving the C side of the codebase as well … or not.

Since the "or not" side is already served perfectly well by simply continuing to use C, for some value of "perfectly well" anyway. I kindof doubt that Carbon will get much traction. Which is for the best really (again IMHO): I'd rather see one effort to replace C++ with something sane+safe actually succeed, long-term, than three such projects, all with somewhat-conflicting goals and all fighting for developer mindset, not to mention time.


Copyright © 2025, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds