|
|
Subscribe / Log in / New account

Bjarne Stroustrup’s Plan for Bringing Safety to C++ (The New Stack)

Bjarne Stroustrup’s Plan for Bringing Safety to C++ (The New Stack)

Posted Nov 2, 2023 19:06 UTC (Thu) by khim (subscriber, #9252)
In reply to: Bjarne Stroustrup’s Plan for Bringing Safety to C++ (The New Stack) by kreijack
Parent article: Bjarne Stroustrup’s Plan for Bringing Safety to C++ (The New Stack)

> and to me it seems simple and enough error proof to the point that the likelihood of an error logic is greater than the likelihood of invalid memory access.

You are in luck, then. Rust handles logic errors just fine. In fact affine type system (which Rust hides behind ownership and borrow checker) was invented many decades ago precisely to handle logic errors and not to handle invalid memory accesses.

The epiphany that converted Rust from yet-another-experimental-language into something-that-may-actually-replace-C/C++ was accidental observation: if you have type system which may prevent data races and ensure that you couldn't use hardware improperly then… you may as well use it to handle memory allocations, too! And drop garbage collector from your language.

It's both hilarious and sad that this, pretty obvious, step took more than quarter-century, but in hindsight it's pretty obvious, isn't it? More rigorous and strict tool should be able to perform duties of more limited and less powerful tool, isn't it?

I guess the fake “fact” that “safe memory management equals garbage collection” was established in mids of developer's community so firmly than no one was even thinking about whether alternate solutions are possible. That's why this, incredibly important, step had to wait for the moment when theorists met practitioners.


to post comments

Bjarne Stroustrup’s Plan for Bringing Safety to C++ (The New Stack)

Posted Nov 3, 2023 11:22 UTC (Fri) by farnz (subscriber, #17727) [Link]

There's an important thing here that pushes against the desire for any language to be stable in the long run (and it remains to be seen if the Rust "editions" system is able to mitigate this); there's always a lot of research ongoing into programming language theory, much of which ends up concluding "yep, we can do this, but it's not practical".

As a result, you either need a mechanism to adopt the things that researchers show are practical and useful, or you stagnate at the state of the art when your language was first designed (at best).


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