News for hackers. Stuff that matters.
Re:Tracking Trust with Rust in the Kernel by pjmlp on Friday September 19, 2025 @03:10AM (#45298763)
You can do this kind of type oriented programming in C++, unfortunely as many people only use it as a better C, this knowledge is seldom widespread, and even when demoing, it needs a lot of advocacy alongside compiler explorer to actually make the point across.

And then the audience will nod yes, accept the message of what is possible, and go back to whatever approach they were doing already.

Re:Tracking Trust with Rust in the Kernel by ultimaweapon on Friday September 19, 2025 @03:26AM (#45298880)
Rust give more ergonomic to this. In C++ it need a lot of typing for creating a new type compared to Rust.
Re:Tracking Trust with Rust in the Kernel by pjmlp on Friday September 19, 2025 @03:52AM (#45299035)
Depends pretty much on the type, if using templates or not, if being anti-macros or not.

It isn't the typing, rather the culture.

Re:Tracking Trust with Rust in the Kernel by tialaramex on Friday September 19, 2025 @12:44PM (#45303714)
Rust's type system is a technology, but technology can be used by a culture to support its goals. The technology alone will not get you there, so the culture is more important, but we do need both for success.
Re:Tracking Trust with Rust in the Kernel by jeroenhd on Friday September 19, 2025 @07:20AM (#45300337)
You need to add a lot of text, but the text contains about the same semantic meaning. It's a lot of typing but that's a matter of density rather than ease of use.

At least in modern c++. Then again, modern C++ seems to play the same role as modern Java, in that some places use it but most of them are stuck at the version they picked when they started developing on a piece of software decades ago.

Re:Tracking Trust with Rust in the Kernel by pjmlp on Friday September 19, 2025 @07:43AM (#45300477)
To be fair to modern C++, or lack thereof, I would assert most places being stuck with specific versions applies to any programming language that traces back to the 20th century.

Turns out updating software versions in most companies is really hard, and updating humans atittude to specific programming practices even harder, unless their job is on the line.

Re:Tracking Trust with Rust in the Kernel by vlovich123 on Friday September 19, 2025 @10:57AM (#45302367)
Rust has solved the problem of upgrading at the language level - you can mix’n’match modules targeting different revisions of the language just fine and you can mix’n’match multiple versions of the same library within a single binary. It makes the whole thing possible to do piecemeal.
Re:Tracking Trust with Rust in the Kernel by pjmlp on Friday September 19, 2025 @11:26AM (#45302692)
Only if there are no incompatible changes on the standard library, public interface or observable semantic behaviours.

And even so, it doesn't matter if IT says no, or the customer doesn't pay for consulting services to upgrade existing projects.

Re:Tracking Trust with Rust in the Kernel by vlovich123 on Friday September 19, 2025 @11:34AM (#45302774)
I’ve never seen IT be involved in a decision about the language edition being selected by a development team or even which dependency to pick. As for consulting, that’s a different type of world that’s not the best example of good software development practices.

As for incompatible changes, there aren’t any in Rust by design. That limits some of the changes they can make even in an edition but in practice it works ok. Even over a longer time span, I think the Rust community will figure out a way to trim irrelevant cruft away.

Re:Tracking Trust with Rust in the Kernel by pjmlp on Friday September 19, 2025 @12:42PM (#45303697)
It happens all the time, in many companies IT decides the images used on the build servers, or cloud instances for developers.

I am not so optimistic when Rust achieves a similar market share and historical baggage, as C and C++ have today, growing since the 1970's.

It is of course better designed, and with better tooling, that doesn't spare it from market forces and companies sponsoring the foundation.

See where Linux foundation is today for a comparable example.

Re:Tracking Trust with Rust in the Kernel by William_BB on Friday September 19, 2025 @09:03AM (#45301229)
Out of curiosity, how would one go about implementing this in C++?
Re:Tracking Trust with Rust in the Kernel by pjmlp on Monday September 22, 2025 @05:36AM (#45331024)
The bare bones skeleton to start exploring the ideas would be something like this, https://godbolt.org/z/Wcend5rT3
Re:Tracking Trust with Rust in the Kernel by tialaramex on Friday September 19, 2025 @09:09AM (#45301291)
Also Rust's borrowck means you can often design an API where it's really easy to fall into our old friend the pit of success with these wrapper types.

Both Rust's OwnedFd and Rust's Mutex<T> have analogous C++ which are used, but lacking a borrowck C++ can't express the idea "Maximum of one person can have this"

What happens if I keep a mutable reference to the Goose despite unlocking the protective mutex? In C++ the answer is you lose mutual exclusion, in Rust that doesn't compile. C++ people will say "Don't do that" but "not doing that" does not scale whereas it doesn't compile scales just fine.

Re:Tracking Trust with Rust in the Kernel by pjmlp on Friday September 19, 2025 @10:30AM (#45302091)
While you are right if we are using the languages on their own, like clippy is common usage on Rust land culture, it is a matter of how much similar tooling gets used on C++, which is sadly a matter of culture, or lack thereof.
Re:Tracking Trust with Rust in the Kernel by vlovich123 on Friday September 19, 2025 @10:54AM (#45302338)
I’ve never seen static analysis c++ tooling that has precise errors, have you? It’s always a littered mess of useful and useless things and I’m not even so sure it would warn about holding on to an interior reference into a lock-protected data structure.

Static analysis in c++ is akin to clippy but without a --fix option and many more false positives. Also clippy is more about stylistic consistency within the ecosystem and completely optional, not about safety which isn’t optional.

Re:Tracking Trust with Rust in the Kernel by pjmlp on Friday September 19, 2025 @11:24AM (#45302666)
Depends on which tools, clang tidy can be customised, Apple just did a talk at C++ Now about their custom checks for Webkit "Safe C++".

Commercial tools like PVS and Coventry, or those used in high integrity computing, also allow for rule customisation.

However the first step is to use anything at all, a challenge since lint was born in 1979.