Live data from Hacker News

Towards a more powerful and simpler C++ with Herb Sutter

blog.jetbrains.com

41–50 of 63 posts

Re: Towards a more powerful and simpler C++ with Herb Sutter

#41
post #13

Jonathan Blow (cult/indie game developer/studio owner) has a lot of ideas about evolving C++ (or rather, building a new language to replace it) specifically in a game industry context. This perspective is interesting because its kind of running at a different angle away from the "memory-safe, better guarantees" project that Rust is workin on. https://www.youtube.com/watch?v=TH9VCN6UkyQ Just as the scripting languages…

From the Rust perspective, there should be no time when Rust is too “bloated” for performance. That’s clearly an ideal but if there are specifics I’d love to hear about them.

We endeavor to not ever leave performance on the table.

Re: Towards a more powerful and simpler C++ with Herb Sutter

#42

Earlier quoted context omitted.

Major influential figures in the C++ community (notably Bjarne Stroustrup and Herb Sutter) are very explicit about having a goal of simplifying everyday usage of C++ (make simple things simple). Watch any of Bjarne's talks over the last few years to see this is one of his main focuses. It's also recognized that backwards compatibility / not breaking existing code are very important however. Yes, that's a hard set of…

Complexity of the language is a much discussed topic. In the trivial sense it is true that the language will inevitably get "more complex" as new features are added but backwards compatibility is largely maintained. I don't believe that is a very relevant metric for usability however. Higher level features are generally added to languages to make them simpler to use but they also make that language more complex by so…

Complexity doesn't come from abstraction, but rather from the lack of simultaneously short and precise descriptions of how things work. C++ isn't complex because “it's flexible enough to support several programming styles” or whatever nonsense. It's complex because its features are all bolted on, rather than parts of a coherent design from the ground up.

Re: Towards a more powerful and simpler C++ with Herb Sutter

#43
post #13

Jonathan Blow (cult/indie game developer/studio owner) has a lot of ideas about evolving C++ (or rather, building a new language to replace it) specifically in a game industry context. This perspective is interesting because its kind of running at a different angle away from the "memory-safe, better guarantees" project that Rust is workin on. https://www.youtube.com/watch?v=TH9VCN6UkyQ Just as the scripting languages…

I went back and forth over email with Jonathan Blow a while back and my opinion is that C++ is moving in a direction where it addresses most of his concerns about its suitability for game programming, though he doesn't agree. I wrote a few blog posts elaborating on why, starting with: http://blog.mattnewport.com/why-c17-is-the-new-programming-l... I should revisit the topic in light of the latest progress with C++ an…

Given the C++ commitment to backwards compatibility, I think the case for a new language in order to reduce complexity is very straightforward. A minimal case would be a C++ subset I guess.

Re: Towards a more powerful and simpler C++ with Herb Sutter

#44

Earlier quoted context omitted.

Complexity of the language is a much discussed topic. In the trivial sense it is true that the language will inevitably get "more complex" as new features are added but backwards compatibility is largely maintained. I don't believe that is a very relevant metric for usability however. Higher level features are generally added to languages to make them simpler to use but they also make that language more complex by so…

Complexity doesn't come from abstraction, but rather from the lack of simultaneously short and precise descriptions of how things work. C++ isn't complex because “it's flexible enough to support several programming styles” or whatever nonsense. It's complex because its features are all bolted on, rather than parts of a coherent design from the ground up.

C++ has a standard which contains extremely precise descriptions of how things work which is more than can be said for many languages. How many other languages are there that have three major compiler and standard library implementations with almost no common code yet which all manage to be largely compatible (able to compile the same code and agree on the meaning)?

Some of the complexity of C++ comes from it doing hard things, some is in part a consequence of heroic efforts at backwards compatibility. There are areas of the language that most people stay away from or use in very constrained ways like multiple inheritance that are unlikely to be deprecated for backwards compatibility reasons but in my many years of professional C++ development multiple inheritance has never caused practical difficulties for me precisely because everybody stays away from it except for pure abstract interfaces.

Re: Towards a more powerful and simpler C++ with Herb Sutter

#45
post #43

Earlier quoted context omitted.

I went back and forth over email with Jonathan Blow a while back and my opinion is that C++ is moving in a direction where it addresses most of his concerns about its suitability for game programming, though he doesn't agree. I wrote a few blog posts elaborating on why, starting with: http://blog.mattnewport.com/why-c17-is-the-new-programming-l... I should revisit the topic in light of the latest progress with C++ an…

Given the C++ commitment to backwards compatibility, I think the case for a new language in order to reduce complexity is very straightforward. A minimal case would be a C++ subset I guess.

But the backwards compatibility is taken so seriously because it is so valuable, much more valuable in practice in my experience than the supposed benefits of creating a new incompatible language with fewer features.

Re: Towards a more powerful and simpler C++ with Herb Sutter

#46

Earlier quoted context omitted.

I went back and forth over email with Jonathan Blow a while back and my opinion is that C++ is moving in a direction where it addresses most of his concerns about its suitability for game programming, though he doesn't agree. I wrote a few blog posts elaborating on why, starting with: http://blog.mattnewport.com/why-c17-is-the-new-programming-l... I should revisit the topic in light of the latest progress with C++ an…

Interesting; i think it’s fairly clear by now engaging with C++ is not going to lead to reduced complexity at all. When was the last time it removed support for a feature? That’s not what the language needs because it’s more interested in preserving existing code bases than it is at improving them (the latter being a huge effort, truly massive, so i understand the decision and don’t mean it as a slight in the least).

> When was the last time it removed support for a feature?

why should it ? Adding features is enough for simplifying stuff.

eg take the following code:

    for(auto& val : {1,3,12,17,20}) { val++; }
it leverages three new features: auto, range-based for, and braced initialization.

How would it look in cpp03 ? Two possibilities:

    std::vector v;
    v.push_back(1); v.push_back(3); ... v.push_back(20);
    for(std::vector::iterator it = v.begin(); it != v.end(); ++it) {
      (*it)++;
    }
Or

    int v[] = {1,3,12,17,20};
    for(int i = 0; i 

Re: Towards a more powerful and simpler C++ with Herb Sutter

#47
post #40

The interview covers proposed metaprogramming features in upcoming versions of C++. In particular, it demonstrates metaclass as a way for users to define new kinds of types, instead of relying solely on class / struct / union / enum . For example, Java has an interface , in which methods are declared but not defined. The proposal for metaclass gives a demonstration of what an interface in C++ could look like: interfa…

That is not a step toward simpler code. Under that proposal, people looking at your code will have to look up definitions of basic things that ought to be keywords---like "interface"---in order to reason about the code.

> Under that proposal, people looking at your code will have to look up definitions of basic things that ought to be keywords---like "interface"---in order to reason about the code.

That's a good thing: now you can refer to 20 lines of code instead of 15 pages of standardese to understand what happens.

Re: Towards a more powerful and simpler C++ with Herb Sutter

#48

This sounds to me like "we will make it simpler by adding more features (that are presumably simpler to reason about)." The problem with C++ (and the reason that it is too complex) is that it has too many features. This proposal will do nothing to eliminate all of the cruft, the real source of complexity. That would require actually removing features, backwards-compatibility be damned!

C++ has many problems. A too complicated language is the least important of those because the newer features are significantly easier to use and read.

Headers suck. Build systems suck. Package management sucks. Compile times suck.

Precisely the things that are not part of the language are those that suck the most.

Re: Towards a more powerful and simpler C++ with Herb Sutter

#49
post #40

The interview covers proposed metaprogramming features in upcoming versions of C++. In particular, it demonstrates metaclass as a way for users to define new kinds of types, instead of relying solely on class / struct / union / enum . For example, Java has an interface , in which methods are declared but not defined. The proposal for metaclass gives a demonstration of what an interface in C++ could look like: interfa…

That is not a step toward simpler code. Under that proposal, people looking at your code will have to look up definitions of basic things that ought to be keywords---like "interface"---in order to reason about the code.

Not really a problem, if a "basic thing" is common enough you just put it into a library. Maybe even the C++ standard library.

The "interface" definition should probably qualify for that.

Re: Towards a more powerful and simpler C++ with Herb Sutter

#50

Earlier quoted context omitted.

Looking at this post https://news.ycombinator.com/item?id=15613848 , I wonder if it could help to simplify C++ by moving some of the existing features into libraries, which you would have to include for backwards compatibility, but could do without if you didn't need backwards compatibility.

Backwards compatibility in C++ means "your existing code still compiles and does the same thing". Can you give an example of a situation where that could be achieved with your proposal?

Well, my thought was that you'd just have different profiles, like is already used:

    -std=c++20-full
or

    -std=c++20-light
Perhaps c++20-light could never become the default, since it would break backwards compatibility, but you could always set the flag.

I dunno. It was just a thought I had when reading about the new feature, not something I've thought through.

Post reply on HN