46
all 12 comments
sorted by: hot top controversial new old
[-] teolan@lemmy.world 18 points 9 months ago

There was always a need for memory safety, we just didn't know how to do it for low-level software and without significant performance decrease.

Now that we have the solution, it's urgent to deploy it.

[-] kSPvhmTOlwvMd7Y7E@programming.dev 7 points 9 months ago

We have a solution

[-] onlinepersona@programming.dev 14 points 9 months ago

The entire article is basically saying: STOP USING C/C++ GODDAMMIT! ๐Ÿ˜‚

[-] bluGill@kbin.social 8 points 9 months ago

Is there a language other than rust that is memory safe? I'm using C++ for good reason, and while rust does have some things I find intriguing, those who have experimented where I work have returned to modern c++ (I have not been able to figure out why). What other alternatives do I have that compile to fast code, have a wealth of libraries, and interoperate well with my existing C++?

[-] snaggen@programming.dev 9 points 9 months ago

The reason might be, that you must think a bit different from C++ so it might be a little bit tricky to do the switch. Thouigh, if you know C++ the ownership and stuff should be a bit easier to understand since you probably can figure out what is going on. The reason I learned Rust in the first place was because I had to use C libraries, and I knew rust had good support for that. But, unfortunately I cannot assist you with alternatives to rust, since I stopped looking after I learned rust. ๐Ÿ˜„

[-] lolcatnip@reddthat.com 9 points 9 months ago

You mean other than most of them? Gotta say this is the first time I've seen someone forget that garbage collection even exists.

[-] bluGill@kbin.social 8 points 9 months ago* (last edited 9 months ago)

I have garage collection in C++. Unique-ptr takes care of almost all my needs (and the exceptions are places where I need to subvert the system and so other garbage collection is a non starters) There is a lot more to memory safety than garbage collection though.

Memory safety does not require garbage collection. Rust doesn't have garbage collection and is memory safe because they annotate the lifetime of each object so that you can't have a use after free error - the only part of memory safety garbage collection helps with. Memory safety is also about not accessing past the end of a buffer, and garbage collection does nothing to help you here. There are a number of other memory safety issues that garbage collection doesn't help with. (most garbage collected languages also give you those things, but it isn't the garbage collector doing that work)

[-] Walnut356@programming.dev 2 points 9 months ago

Seems you missed the last line

compiles to fast code

[-] BatmanAoD@programming.dev 6 points 9 months ago

That's an extremely niche set of requirements, largely because interoperating with C++ is, well, a nightmare, and partly because "fast code" means something very different to C++ devs than to most devs who use managed runtimes.

Also, there are different definitions of "safe". Rust takes a very C++ style view: it's "safe" in the sense that UB requires either a compiler bug or an explicit opt-in to something unsafe.

For other definitions of "fast" and "safe", sure, most garbage collected languages count. Java, C#, and Go are "fast enough" for most application code, and they mostly guarantee that errors will result in crashes rather than UB. Zig is as fast as C/C++/Rust (and integrates much more easily with C than any other language except C++) and has a very different approach to safety (mostly runtime checks in debug mode that are not included in release mode).

[-] jcbritobr@mastodon.social 4 points 9 months ago* (last edited 9 months ago)

@snaggen Cyber security problems seems to be a major issue to fix in this decade.

this post was submitted on 22 Sep 2023
46 points (97.9% liked)

Rust

5452 readers
20 users here now

Welcome to the Rust community! This is a place to discuss about the Rust programming language.

Wormhole

!performance@programming.dev

Credits

  • The icon is a modified version of the official rust logo (changing the colors to a gradient and black background)

founded 1 year ago
MODERATORS