This weekly roundup thread is intended for all culture war posts. 'Culture war' is vaguely defined, but it basically means controversial issues that fall along set tribal lines. Arguments over culture war issues generate a lot of heat and little light, and few deeply entrenched people ever change their minds. This thread is for voicing opinions and analyzing the state of the discussion while trying to optimize for light over heat.
Optimistically, we think that engaging with people you disagree with is worth your time, and so is being nice! Pessimistically, there are many dynamics that can lead discussions on Culture War topics to become unproductive. There's a human tendency to divide along tribal lines, praising your ingroup and vilifying your outgroup - and if you think you find it easy to criticize your ingroup, then it may be that your outgroup is not who you think it is. Extremists with opposing positions can feed off each other, highlighting each other's worst points to justify their own angry rhetoric, which becomes in turn a new example of bad behavior for the other side to highlight.
We would like to avoid these negative dynamics. Accordingly, we ask that you do not use this thread for waging the Culture War. Examples of waging the Culture War:
-
Shaming.
-
Attempting to 'build consensus' or enforce ideological conformity.
-
Making sweeping generalizations to vilify a group you dislike.
-
Recruiting for a cause.
-
Posting links that could be summarized as 'Boo outgroup!' Basically, if your content is 'Can you believe what Those People did this week?' then you should either refrain from posting, or do some very patient work to contextualize and/or steel-man the relevant viewpoint.
In general, you should argue to understand, not to win. This thread is not territory to be claimed by one group or another; indeed, the aim is to have many different viewpoints represented here. Thus, we also ask that you follow some guidelines:
-
Speak plainly. Avoid sarcasm and mockery. When disagreeing with someone, state your objections explicitly.
-
Be as precise and charitable as you can. Don't paraphrase unflatteringly.
-
Don't imply that someone said something they did not say, even if you think it follows from what they said.
-
Write like everyone is reading and you want them to be included in the discussion.
On an ad hoc basis, the mods will try to compile a list of the best posts/comments from the previous week, posted in Quality Contribution threads and archived at /r/TheThread. You may nominate a comment for this list by clicking on 'report' at the bottom of the post and typing 'Actually a quality contribution' as the report reason.

Jump in the discussion.
No email address required.
Notes -
This is wild for me. I work in HFT and almost never have to touch pointers even in cases where latency/performance is important to absurd levels. I know you said you don't work anymore, but passing pointers around threads like what you are describing is not even a good C++ practice: https://floooh.github.io/2018/06/17/handles-vs-pointers.html. Pointers are too big on 64 bit systems and will mess up your cache locality and you will often get horrible assembly because aliasing (more details on that below).
What design flaw is tokio solving? It is quite inherent in Rust that the language doesn't ship with a default runtime, so there is experimentation around this. And tokio is a really fantastic piece of software. Maybe you are thinking of libraries like async-trait? It can be annoying to find gaps like this in the language that takes years to close, but they have been going down in numbers rapidly, and it is quite nice that different solutions can be tested as macro libraries before being baked into language design. Definitely beats a committee hashing out nonsense which then cannot be changed forever because muh backwards compatibility.
Yes and this is fantastic design because aliasing. If you ever stared at absolutely horrible assembly because gcc couldn't prove two pieces of memory are not overlapping, you understand why this language design exists. It is not for political reasons or giving an illusion of progress over C++. Godbolt guy's recent compiler optimizations video is a decent primer: https://youtube.com/watch?v=PPJtJzT2U04?si=kZ3CFZKlzDCeSRxX. mut is much superior to const for this reason alone. Crazy that C has the reserved keyword to address this problem, but C++ doesn't even have this. (also it is a correct choice to make the default non-mut, makes reasoning about code much easier). I think you have a point about interior mutability confusing this relationship though. You win some you lose some.
I am not very knowledgable about this subject, but if const MyStruct contains a pointer in it, you can simply mutate the pointed data right? Chatgpt seems to think so. Then this is the exact same problem you are complaining about with Rust Refcell/Mutexes. Your const MyStruct doesn't guarantee anything at all not already guaranteed by Rust shared reference or Rc/Arc without interior mutability.
Yes the newtype pattern is extremely standard in Rust and I do it all the time.
Usually when you newtype something, you are doing so because you don't want the inside type to be accessible as it is anymore, but only through a certain limited interface. In most use cases you should be writing the newtype in a way that the user can do everything they need through the newtype. It is pretty trivial to define arithmetic operations on your newtype for example
So, you have some good responses and I want to repeat that this is all just my opinion and personal experience. Thanks for the reply.
I won't address your criticism of our design because you don't know the details (and I'm not going into them). But we're not stupid people. Not collectively, at least... :) This attitude of "I've thought for three whole minutes and I can't see why anybody would ever want this, so the people telling me they want this are wrong" is kind of emblematic of Rust's design vs C++'s.
I agree it's nice that Rust solves the aliasing problem. They didn't have to solve it by confusing mutability and exclusivity, though! It's like if a plumber comes and fixes my toilet, but breaks some windows on the way out. The correct response to "hey, why did you break the windows" isn't "look, the toilet's fixed!"
You can if you can access it, yeah, but it'd be weird for the C++ object to give a user access to raw internal pointers. Note that in most cases you're also limited on what methods (including getters/setters) you can call on a "const MyStruct" - whether a function is read-only or not can be explicitly declared in its signature. Now, you don't have to use const at all in a library. Or you could use it but then have the same "internal mutability" as Rust - but why would you do that? The point of the keyword's existence is to allow programmers to positively assert "this is what a read-only version of this object looks like". Which is powerful and important and should be easier than it is in Rust.
If your complaint is that "const" doesn't force the C++ programmer to be safe, you're right about that. C++ gives options, not restrictions, and for bad programmers it is indeed full of footguns. My praise of "const" is due to what it can be in the hands of good programmers - and I would have loved it if Rust introduced the keyword but applied its stringent safety guarantees to it.
But the heap example I give is the exact opposite of this. I want access to the inside type (the number) - I never want to think about the heap's operator except at initialization - but instead I'm being forced to wrap it everywhere. Now, it's not entirely fair to compare Rust's library with C++'s STL. Like you said, "it can be annoying to find gaps like this in the language that takes years to close" - Rust is young, and the STL is the result of decades of finetuning/nitpicking work from thousands of people. I agree that, in the future, something like Rust's bad heap implementation might be a non-problem.
More options
Context Copy link
More options
Context Copy link