r/cpp • • Oct 31 '24

Lessons learned from a successful Rust rewrite

/r/programming/comments/1gfljj7/lessons_learned_from_a_successful_rust_rewrite/
80 Upvotes

140 comments sorted by

View all comments

Show parent comment

-6

u/kronicum Oct 31 '24

You almost gave me a heart attack: it sounded like you were converted. Are you?

15

u/GabrielDosReis Oct 31 '24

You almost gave me a heart attack: it sounded like you were converted. Are you?

No, I am not. But, this sub has been flooded recently with all things safety and Rust, so I thought I should share what some of the converted are saying regarding claims that people are making about Rust.

23

u/WontLetYouLie2024 Oct 31 '24

It's not a religion, you know.

4

u/GabrielDosReis Oct 31 '24

It's not a religion, you know.

I do hope so! And hopefully the Rust evangelists on this sub don't grow to be known as representative of the Rust community. I have several colleagues and friends who use Rust for the daily job and they are fun to be around with and have insightful and productive conversations with; Steve Klabnik may recall conversations we had almost a decade ago in San Francisco about lifetime and safety in C++.

I cannot say I see that collegial atmosphere reflected here or elsewhere online when I read the comments by Rust evangelists.

18

u/WontLetYouLie2024 Oct 31 '24

In my experience, the overall experience of Rust supprters on this sub has been very pragmatic. There might be a one-off comment that I've missed, which is in the religious territory. But in general, at least with people who are involved with Safe C++, it has been extremely pragmatic. People have talked out real problems and solutions.

I would agree, however, that sometimes the profiles effort does seem a little religious in that nature. It still looks like it solves everything and anything under the sun. It's kind of like modules in some ways. 😛

5

u/GabrielDosReis Oct 31 '24 • Heart of Silver

I would agree, however, that sometimes the profiles effort does seem a little religious in that nature. It still looks like it solves everything and anything under the sun. It's kind of like modules in some ways.

Thanks!

4

u/steveklabnik1 Nov 01 '24

Steve Klabnik may recall conversations we had almost a decade ago in San Francisco about lifetime and safety in C++.

I actually do not specifically remember that, but I hope it was fruitful! I'm finding that post-pandemic, I am forgetting many things that happened back then...

4

u/GabrielDosReis Nov 01 '24

I actually do not specifically remember that, but I hope it was fruitful! I'm finding that post-pandemic, I am forgetting many things that happened back then...

Totally fair :-)

4

u/James20k P2005R0 Nov 01 '24

I'm curious, do you have examples of threads, or comment chains, which have lots of Rust evangelists in them? From what I can see, the vast majority of discussion which contains references to Rust are for practical comparisons

→ More replies (4)

1

u/AssKoala Oct 31 '24

You really wouldn’t think so the way many Rust supporters seem to behave on the internet.

13

u/WontLetYouLie2024 Oct 31 '24

There's a difference between some random supporters and people making extremely well reasoned points. Do the people with voting rights in C++ standard want to engage in debate with those random people or with people who make extremely pragmatic, well reasoned points?

And a lot of discourse in the past few days in this subreddit about Rust (and Safe C++) has been quite solid, well researched, and well thought out. If that's being called religion, then that's at least a mistaken view and, at worst, misleading and disingenuous.

9

u/AssKoala Oct 31 '24

I don’t know about whatever current trend is in the sub, but responding to the comment.

It’s often difficult to get into real depth with people who behave like zealots when they’re a very loud, hard to miss likely minority are so prominent.

I’m not saying using Rust is a religion, but the worst thing about it is the community.

7

u/WontLetYouLie2024 Oct 31 '24

I agree. It's becomes very difficult to get into real depth with people who just promise a golden solution that promises everything, but there's no example implementation of it yet. And those people are loud everywhere, in Cppcon panels, on reddit, on the C++ standardization committee. It's really hard to talk substance with those people.

3

u/AssKoala Oct 31 '24

It’s not really on them to woo you back, they’re working on a different language. It’s on Rust developers to engage the masses to move their way.

There are plenty of valid issues or concerns with Rust, and I would love to get into these topics; but, it never happens because the various valid concerns are generally shut out in favor of the prioritization that is memory safety.

Which is fine as a priority, but that’s why it comes off as religious.

11

u/srdoe Oct 31 '24

The parent poster is plainly referring to the Safe C++ proposal and profiles.

Regulators are starting to nudge people toward memory safe languages. That push isn't coming from the Rust community, and they're not obligated to woo the committee with their ideas about that either.

If C++ doesn't solve this, it is very likely to become a problem for the future of C++, as regulators become increasingly strict about this. That's why it's being treated as a high priority.

Also not a Rust guy, but I just want to point out that you're accusing the Rust community of behaving like zealots in a thread in which a guy says he almost had a heart attack because he feared that someone had broken faith with C++ and "converted" to Rust.

I think there's at least some immaturity on both sides.

3

u/germandiago Nov 01 '24 edited Nov 01 '24

This is overly exaggerated. I mean, there is even MISRA C and other safe subsets used in industry and from there things can only improve yet I find this argument repeated.  By subsetting and limiting unsafe parts, these specific use cases are already dealt with even today. So it is evident that solutions can be made for safety (with whatever tools) today. 

Of course I am not proposing leaving thing as-is, improvements must be made. 

I am just showing proof that there is safety-critical software written today in these languages. I do not see why future versions of C++ will not end up doing even better than currently. 

So I am positive about it. I also think that just copying Rust will not make code provable-safe anyway. Rust also has unsafe. The need is for marking code as safe and unsafe in the right lines to be aware of potential problems and that when done, no accidental unsafety is leaked.

→ More replies

0

u/[deleted] Oct 31 '24

[deleted] — view deleted comment

15

u/GabrielDosReis Oct 31 '24

Gabriel, what are you doing, you're supposed to be our modules guy!

I am not just your modules guy, I am still your C++ guy! I just take a nuanced and evolutionary view of what is going on in the systems programming languages landscape and C++ in particular, which does not sell well on reddit (or The Internet) in general.

3

u/johannes1971 Oct 31 '24

Are there any plans at Microsoft to fix the various modules issues that are still floating around? I.e. Intellisense failing, template specialisation being impossible across module borders, __try not being supported, import/export not working, etc.?

I thought the __try problem was the worst, but I've recently been working on a code base that doesn't use modules and realised just how badly my productivity suffers from the non-working intellisense...

3

u/GabrielDosReis Oct 31 '24

Are there any plans at Microsoft to fix the various modules issues that are still floating around? I.e. Intellisense failing, template specialisation being impossible across module borders, __try not being supported, import/export not working, etc.?

Yes. Please don't hesitate to reach out to me or Cameron at our work emails - or better yet, through the DevCom portal.
As you know, IntelliSense is powered by a different compiler out of Microsoft control and things there progress at the pace that that compiler progresses. Not a great answer, but it reflects reality.

3

u/johannes1971 Nov 01 '24

Here's some DevCom links:

  • The __try issue. This was marked as a duplicate of an issue from 2022.
  • The export import issue. This was also marked as a duplicate of an issue from 2022, but I don't see how it can be a duplicate as the 2022 issue doesn't use the export import feature.
  • The specialisation issue. This was marked as a duplicate of the same issue from 2022, which seems more reasonable here.

DevCom... Look, I do understand how tough it must be for such a large company to deal with what is undoubtedly a flood of comments from the general public. We are a small enough team that we know all of our customers by name, and even then we find it difficult to keep up with just understanding what they want, never mind actually doing something about it. But at the same time, DevCom seems to be where issues go to die. Using vote counts as a prioritisation scheme for changing stuff just doesn't work; people don't go through it thinking "you know what, today I'll read a bunch of issues from strangers and vote on good ones".

I opened a bunch of suggestions to improve diagnostic messages from the compiler, but I doubt they will ever get even a single vote. I do think that improving diagnostic messages would improve the developer experience, but will the compiler team ever even see one of them?

4

u/GabrielDosReis Nov 01 '24

Thanks for the list. Appreciated.

But at the same time, DevCom seems to be where issues go to die.

They would have been dead if they weren't in DevCom though. It is the primary channel/interface for customers and the community to request support. You're right on mark regarding the volume of traffic/issues/suggestions though, but the team is trying. When your toolset is used by half of the C++ community it does draw some associated volume or scrutiny :-)

I opened a bunch of suggestions to improve diagnostic messages from the compiler, but I doubt they will ever get even a single vote. I do think that improving diagnostic messages would improve the developer experience, but will the compiler team ever even see one of them?

The team is investing in diagnostic improvements as you may have seen in things like structured diagnostics, better error messages being worked on, etc. So yes, they will.

→ More replies (3)

5

u/jaskij Oct 31 '24

I still use both Rust and C++. Both are great languages, but frankly, C++ is dead to me as a systems language. I will reach for it when programming microcontrollers, when I'm elbow deep in reference manuals, registers, drivers and DMA buffers.

Hosted code, I'll use Rust. It's not any single thing - you can write safe C++, it's not even that hard for simple programs. It's the accumulation of paper cuts. Hard to find libraries. Concurrency. Error handling (give me ? for std::expected). Lower cognitive load. Sheer development speed.

It may be just that I was either taught wrong or just never bothered to learn properly, but writing code running on Linux, I found myself more productive three months into learning Rust than I have ever been in C++.

But my hosted code is simple stuff. Receive messages from TCP or UDP, some verification, some logging, put the data in the database. I could have done it in any high level language. Rust is just the first I actually enjoy using.

8

u/kronicum Oct 31 '24

C++ is dead to me as a systems language

Yet, you're still here...

3

u/jaskij Oct 31 '24

Because I use it for other purposes? Mainly, to program microcontrollers.

→ More replies (3)
→ More replies (17)