Live data from Hacker News

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

blog.jetbrains.com

21–30 of 63 posts

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

#21
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…

As Ex-Gamedev I don't buy that #2 is too bloated for C++, you just have to be smart about what features you pick. Really though for what he wants to do you want a flexible framework(scripting language) backed by a fast engine(native). Jai sounds pretty interesting but I don't know if Blow has the interest in building an ecosystem around it or just using it for his own projects. FWIW my ideal use case is Lua + Rust. I…

Agreed

The only case I see for "C++ is too bloated" is for embedded apps on limited hardware and even then

But then of course people make something that's 10 inheritance levels deep and (ab)uses templates and then suddenly "C++ is slow". Write better code

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

#22

Earlier quoted context omitted.

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).

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…

Simplifying every day usage is entirely a different thing than simplifying the language. I’m not denying the inprovement in usage, just that you should expect the complexity of the language to continually increase because that’s the needs of the c++ community.

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

#23
post #4

Earlier quoted context omitted.

The best way to add new language primitives without breaking anyone is to pick a syntax that currently fails to compile. `reflexpr interface {...}` could be declaring and initializing a global. `$class`, on the other hand, doesn't compile. One could also do `virtual class` or something, I guess, since `virtual class` is a combination of reserved keywords.

You are correct. But there is another side too. $ makes the language way uglier than it is now, and C++ is ugly language already.

Why does it make C++ more ugly? Do you find PHP ugly too?

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

#24

Earlier quoted context omitted.

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).

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 some metrics. You can argue that assembly language is "simpler" than C++ because it lacks "complex" higher level abstractions but I'd rather wrote code in C++98 than assembly most of the time and I'd rather write code in C++17 than any previous version of C++ because it continues to get more usable and simple things get simpler.

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

#25

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).

C++17 removed trigraphs. C++17 removed dynamic exception specification which is deprecated since C++11. C++17 removed operator++ for bool which is deprecated since C++98. C++17 removed the “register” storage class.

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

#26

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…

Simplifying every day usage is entirely a different thing than simplifying the language. I’m not denying the inprovement in usage, just that you should expect the complexity of the language to continually increase because that’s the needs of the c++ community.

My question then is why should I care about "increased complexity" by this definition more than about "simpler usage"? Adding well thought out language features that simplify my every day usage is a good thing and the sense in which it increases complexity is not a sense that particularly concerns me. I think C++ is generally making good choices about what features to add. Generic complaints about new features tautologically "increasing complexity" are not interesting. Specific concerns about particular features not carrying their weight in terms of simplifying usage are interesting (and a big part of what the C++ standards process is engaged in).

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

#27
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!

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

#28
post #18
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 don't think this is specifically a C++ problem, I think it's a problem for any language which tries to be generalist and encompass many use cases without finding a well-defined niche. Namely, the compromises that a language makes in order to appease wildly divergent use cases will make it less than optimal at many of them, and if demand is high enough for any one of those use cases, then a different language that i…

C++ design principles are already a good match for game development however. Specifically its intent to leave no room for a lower level language (except assembly) and to provide zero cost abstractions. There are lots of things C++ doesn't try to be and the are lots of languages more popular in particular domains as a result. C++ dominates game development (and particularly game engine development) because it is the best available match to the needs of that domain. It continues to try and evolve to match those needs better (that's why there's a game development focused study group SG14 on the standards committee, show me another language that takes the needs of game developers that seriously).

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

#29

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!

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.

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

#30
Yeah Metaclasses in Python are obviously so powerful and make programs so easy to read, so let's just go ahead and add those as well.

Now we only write

    struct Point {
        int x;
        int y;
    };
to get the oh-so-needed

    class Point {
    private:
        int x;
        int y;
    public:
        Point() =default;
        ~Point() noexcept =default;
        Point(const Point&) =default;
        Point& operator=(const Point&) =default;
        Point(Point&&) =default;
        Point& operator=(const Point&&) =default;
    };
Genius! Almost like 1972 where we wrote the former and that was just fine!
Post reply on HN