News for hackers. Stuff that matters.
Re:Current hardware trends make C++ exceptions harder to jus... by zozbot234 on Tuesday February 22, 2022 @02:31PM (#30432481)
> it still seems like it has settled into a lower-frequency churn rate lately for "best practices" than C++.

Rust is still adding a ton of new language features, especially around async, compile time code evaluation and the type system (const generics, GAT/HKT, existential types etc.). We'll very likely see further developments in more areas next, e.g. to match C++ developments in parallel and heterogenous compute (GPU's and the like), or to add forms of proof-carrying code, etc.

Re:Current hardware trends make C++ exceptions harder to jus... by jerf on Tuesday February 22, 2022 @03:27PM (#30433248)
A lot of that is not what I mean by "churn". What I mean by "churn" is changes in best practice. Python has been adding a lot of features, but with the possible exception of static typing support, most of them haven't made many changes to what constitutes best practices. They might make "nicer ways to write that code" but the old styles haven't been deemed wrong. async is also not exactly what I mean; this allows new code to be written that mostly couldn't before. This one is only a partial miss though since it did deprecate some older libraries, but those libraries weren't really deemed "the right answer" either.

C++ is constantly changing what a "best practice" is. The latest hotness from three-generations-ago churn is now considered broken.

Re:Current hardware trends make C++ exceptions harder to jus... by ncmncm on Wednesday February 23, 2022 @12:28AM (#30437987)
C++ gets new features that provide a better way to solve common coding problems. This is not accidental, and not a problem: the new features were added because they offer that better way.

Failing to use the new feature is just failing to write code the best way that is available right now. In 2013 you had no choice but to do it the old way; but you don't have to anymore, because the language and std library have caught up with you.

Being responsive to the needs of its community of programmers is job one for a language committee. If new, better ways don't arise, your language has stagnated.

Re:Current hardware trends make C++ exceptions harder to jus... by ModernMech on Wednesday February 23, 2022 @03:13AM (#30438842)
> This is not accidental, and not a problem

You're right it's not accidental, but the problem is that when you continually add new features you end up creating a confusing mess. Yes, the new features may respond to some need in the community, but by adding it you've also:

- Introduced possibly unforeseen issues because features are never added in isolation; they interact with one another, and the more features you have the harder it is to test them all.

- Created confusion because now all the old information on the internet is out of date

- Everyone needs to update their tooling to support the new features.

- Make it harder for new people to start learning the language

> Failing to use the new feature is just failing to write code the best way that is available right now. In 2013 you had no choice but to do it the old way; but you don't have to anymore, because the language and std library have caught up with you.

This is a nice idea but it doesn't reflect reality. If the C++ user survey [0] is to be believed, a full 67% of users were restricted from using the latest C++ at the time (either fully or certain features).

> Being responsive to the needs of its community of programmers is job one for a language committee.

This is true but it also must be balanced against mission scope creep and design considerations. Being everything to everyone is not design.

[0] https://isocpp.org/files/papers/CppDevSurvey-2018-02-summary...

Re:Current hardware trends make C++ exceptions harder to jus... by ncmncm on Wednesday February 23, 2022 @03:50AM (#30439096)
You are very confused.

People not using the latest Standard are waiting for support within their particular environment, not because they want to stay with a less performant version of the language.

Re:Current hardware trends make C++ exceptions harder to jus... by ModernMech on Wednesday February 23, 2022 @07:28AM (#30440309)
But they’re still not on the latest version…
Re:Current hardware trends make C++ exceptions harder to jus... by ncmncm on Wednesday February 23, 2022 @01:33PM (#30444558)
People not using the latest Standard are waiting for support within their particular environment, not because they want to stay with a less performant version of the language.
Re:Current hardware trends make C++ exceptions harder to jus... by ModernMech on Wednesday February 23, 2022 @02:03PM (#30444902)
But this is what you said:

> Failing to use the new feature is just failing to write code the best way that is available right now. In 2013 you had no choice but to do it the old way; but you don't have to anymore, because the language and std library have caught up with you.

What I hear you saying is that failing to use new features is a failure to write the best code available, and that before maybe you didn't have a choice but not anymore.

And yet, huge chunk of C++ devs are forbidden by their organizations from using various C++ features that have been added throughout the years. It's not just C++ 17 but it goes back even further. This is the whole point of TFA. So it's not just that people are "waiting" for tools to catch up, unless you have evidence of this.

Re:Current hardware trends make C++ exceptions harder to jus... by ncmncm on Wednesday February 23, 2022 @02:53PM (#30445514)
Organizational inertia is a problem, but not a problem that a language or Standard can fix.

When an organizational logjam is broken, programmers can immediately switch over to the better, more modern way of coding enabled by the newer Standard they are allowed to use. If they were on C++98, and now they can use C++14, they are still better off than before, even if the current Standard is C++20: they will be able to code according to best practices for C++14, which are better than for C++98.

Re:Current hardware trends make C++ exceptions harder to jus... by dureuill on Tuesday February 22, 2022 @03:26PM (#30433232)
I'm not convinced they're comparable.

C++20 is adding a module system to C++. That's a major change to the compilation model. It is also adding concepts, a major change in the way templates are to be written. The very article we're commenting on is discussing how exceptions should possibly be replaced by another error report mechanism, several proposals are in flight for this. There's also the "destructive moves" proposals that have the potential to change a lot how we write types.

A telltale sign that these changes are major is that the entire std has to be "modularized" to support modules, and to be modified to support concepts. Similarly if exceptions are to be revised a large chunk of exception using functions from the std would need to be modified.

On the Rust side, I think the only change that has even a comparable impact is const generics (and maybe specialization).

Existential types and GAT will change how to express some traits (allowing a LendingIterator for example), but I don't expect they will affect a large portion of Rust's std.

Also of note is that the Rust changes come to add new systems orthogonal to the existing features (const generics fill an obvious void compared to C++, same with GAT and existential types where Rust's expressivity is limited in comparison with C++ atm). By contrast in C++, the module system comes to replace the headers, and a change to exceptions would replace the current exception system, creating churn.

Re:Current hardware trends make C++ exceptions harder to jus... by pjmlp on Wednesday February 23, 2022 @04:45AM (#30439426)
> It is also adding concepts, a major change in the way templates are to be written.

Indeed, instead of crazy tricks with SFINAE and tag dispatch, templates can be much easily written.

Re:Current hardware trends make C++ exceptions harder to jus... by dureuill on Wednesday February 23, 2022 @07:21AM (#30440264)
That's probably correct, I did not use concepts at the moment (stuck in C++14 right now). I certainly have my beefs with both features (modules that are orthogonal to namespace, no standard way to find modules, new and exciting ways of committing ODR violations, generally a complicated module system with quirks when there is so much prior art on modules in other languages, concepts being structural and not nominal, concepts being a "lower bound" on behavior and not an "upper bound" (thus not eliminating duck typing)), but my larger point is the scope of these changes to the language, not their (purported) benefit that I'm by and large unable to assess right now.
Re:Current hardware trends make C++ exceptions harder to jus... by pjmlp on Wednesday February 23, 2022 @08:03AM (#30440504)
Modules are mostly working on VC++, no quirks needed. In fact, I only use modules for my hobby coding now.