News for hackers. Stuff that matters.
Re:C++ Coroutines Do Not Spark Joy by vanderZwan on Monday November 01, 2021 @07:34AM (#29065397)
To reword what you are saying in a slightly less dismissive tone: there are a lot people who stick to C because they don't like the added complexity of C++ (real or perceived). The same people are likely to look at Rust and perceive a lot of added complexity on their first impression, while also already feeling comfortable with C's complexity. With that combination switching over becomes a hard sell.

Meanwhile Zig has a lot less perceived complexity, and most of it appears to be similar enough to the "C complexity" that C programmers are already familiar to not scare them off.

(Again, I'm just giving outsider impression of someone who just read a ton of blog posts and basic tutorials + standard library stuff without really coding in either language)

Re:C++ Coroutines Do Not Spark Joy by jerf on Monday November 01, 2021 @11:21AM (#29067863)
If you're really, really good at C, you'll have realized that Rust doesn't add much to what you need to do. You're already doing what Rust does, you're just doing it manually without compiler support. Rust didn't create the issues associated with borrowing things, it merely surfaced them. They're always there, in any language you use, and since C is so manual, you better have figured that out if you plan on using it at a high level. I write mostly in Go, but I'm constantly tracking "ownership" issues in my language despite not having a "borrow checker", because the borrow checker doesn't create the issue.

Plus if you're using C at a high level you ought to be using a static analyzer anyhow, that may not impose the exact same restrictions on you as Rust, but should be imposing enough discipline on you that using Rust doesn't seem so foreign.

Re:C++ Coroutines Do Not Spark Joy by nicoburns on Monday November 01, 2021 @11:03AM (#29067537)
I think this is definitely a reasonable take. Having said that, Rust is not quite as complex as C++ so a lot of people who have rejected C++ are more open to Rust (the linux kernel being a prominent example).
Re:C++ Coroutines Do Not Spark Joy by pron on Monday November 01, 2021 @02:23PM (#29070769)
> Rust is not quite as complex as C++

Yet. C++ wasn't as complex as C++ back when it was Rust's age. It wasn't even as complex as Rust. But if you pick a language for the next 20-30 years, you don't just care about where it is now, but also about where it is headed.

Re:C++ Coroutines Do Not Spark Joy by tialaramex on Monday November 01, 2021 @03:51PM (#29072088)
If you get things right first time, you don't need to add as much complexity on the journey to ship something usable.

This is obviously easier coming from behind. You simply don't have to (and shouldn't) repeat other people's mistakes.

> It wasn't even as complex as Rust

I'm particularly dubious about this claim. Even counting from the genesis of C++ rather than standardisation, yet counting Rust as starting only in 2015, C++ after six years not only has multiple inheritance and overloading of everything, it also already has templates. That's a lot of complexity.

Re:C++ Coroutines Do Not Spark Joy by pron on Monday November 01, 2021 @05:13PM (#29073175)
> If you get things right first time, you don't need to add as much complexity on the journey to ship something usable.

There's no such thing as "getting things right the first time," because what's right depends on external, mutable, factors. The best anyone can do -- and most successful languages achieve -- is being well adapted to the environment. But the environment changes. For example, Java's object model was well adapted to an environment where memory access and computation were of roughly similar speed, but hardware changed so that computation is now faster than memory access, so Java is now changing to adapt to the current environment. On the other hand, its bet that memory is cheaper than computation has so far proven relatively long-lasting. But there's no telling what needs new hardware architectures or new software requirements will bring tomorrow.

Both Java and C have adapted better, in my opinion, than C++, and it's not because of specific features, but because of their evolution ethos, which is different not only from C++'s but also from each other. My personal opinion is that C++ has tried for too long to be both high and low level, and that has shaped its particular evolution. I feel that Rust is repeating that same fundamental mistake, but, of course, others may disagree.

Re:C++ Coroutines Do Not Spark Joy by tialaramex on Monday November 01, 2021 @07:07PM (#29074466)
I don't agree that it's somehow impossible to get things right and I'm not even sure you really believe that.

Take "explicit". In hindsight I suspect even many C++ proponents would agree that actually you don't want C++ conversion behaviour (when calling a function that takes a parameter of type X and you've provided a parameter of type Y, the C++ compiler will look for any way to construct an X that only needs a Y and then call that constructor rather than report that you've got the wrong type) by default. Perhaps C++ should have implicit conversion you can opt into, but it certainly should not have (as it does today) implicit conversion you must know about and opt out of to avoid blowing your feet off by mistake.

But I argue that it goes much further than such superficial mistakes. Multiple inheritance is a mistake. Personally I'm sold on the theory that all type inheritance is a mistake full stop (heritability should be a property only of interfaces), lots of people don't agree, but far fewer support the choice C++ made to embrace multiple inheritance of types. It's just so rarely even useful let alone the best option to solve a problem.

Re:C++ Coroutines Do Not Spark Joy by pron on Tuesday November 02, 2021 @04:33AM (#29078520)
> I don't agree that it's somehow impossible to get things right and I'm not even sure you really believe that.

That depends what you mean by "things." Obviously, languages created in 2015 might fix mistakes made in 1985, and recognised as mistakes, in, say, 1995. But the things that a language needs to solve over its lifetime are mostly unknown when it's created. How the language handles the problems that are known when it's created is less interesting. If it doesn't do it well, it will never become popular. What's interesting is how it adapts when those problems change with time and new ones appear.

Re:C++ Coroutines Do Not Spark Joy by pjmlp on Monday November 01, 2021 @10:27AM (#29066981)
They can even do use-after-free errors just like in C.
Re:C++ Coroutines Do Not Spark Joy by vanderZwan on Monday November 01, 2021 @11:17AM (#29067783)
Oh sure, but how many people who choose to be C programmers do you know who would be scared off by that? That's exactly what "familiar complexity" is about: people being comfortable with and not worrying about things that they're used to, even though they maybe should feel uncomfortable and worry a bit.
Re:C++ Coroutines Do Not Spark Joy by pjmlp on Monday November 01, 2021 @12:11PM (#29068725)
Many people that choose to be C programmers think they can manage it, until their code runs under SonarQube or similar tools.

It is like handling butcher knifes without metal gloves, they think they are worthless until they repent not wearing them.