Live data from Hacker News

Trip report: Summer ISO C++ standards meeting in Varna, Bulgaria

herbsutter.com

71–80 of 141 posts

Re: Trip report: Summer ISO C++ standards meeting in Varna, Bulgaria

#71

I still think they should stop adding new features and do what the C committee does in keeping the language stable over the decades which it will take to slowly die, as it should. Can't the new-feature enthusiasts just make a new language, or join existing efforts at building new ones? C++ is already a mess of around 3.5 languages jumbled together. When will it stop?

Many of these "new-feature enthusiasts" work at companies like Google and Meta where they have both enormous C++ codebases and dedicated teams that constantly work on internal libraries and tooling to make those codebases better. They will be using these features because they can mandate it.

Some big new C++ features reflect this reality, for example coroutines: it's not a feature you would use directly as an application developer, but it provides sufficiently flexible underpinnings that allow these FAANG teams (and other library developers of course) to integrate coroutines into their existing async libraries and start converting code over.

Re: Trip report: Summer ISO C++ standards meeting in Varna, Bulgaria

#72
post #35

It's nice that whatever may be going on in life, at least we've always got an exciting new C++ release to look forward to every 3 years. I'm particularly excited that C++23 is finally getting std::flat_map and flat_set, more memory-friendly data structures with much nicer latency characteristics than the old non-flat variants.

flat maps are not quite what many assume they are, some panacea for performance. In fact for most cases, you will still benefit from using the ordinary maps already provided in C++. In fact if you merely swap out std::map with std::flat_map, most code will start running much more slowly. They have a very specific, limited use case and for everything else, you should not make any changes.

Your comment has a gaping lack of real world profiling and "it depends", so that's likely why it's getting downvoted.

> most code will start running much more slowly

Most code, as in, most code that uses it? Are there are stats on how exactly std::map (and std::unordered_map, the more useful general purpose map) are used?

Re: Trip report: Summer ISO C++ standards meeting in Varna, Bulgaria

#74
post #36

Earlier quoted context omitted.

> (...) any reasonable change (e.g. networking, fiber, reflection etc) (...) Except those aren't small or simple or trivial or consequence-free. Also, we're talking about standardizing current practices. You can do networking in C++ in a myriad of ways already, and none of which is standard.

For vocabulary reasons it makes sense for the standard library to express basic types. That's why Rust's core::net::Ipv6Addr - sure, this $5 WiFi-enabled thermal probe and a $5000 100Gb/s fibre switch probably have no common elements when it comes to how they actually do networking, but it's worth acknowledging that 128-bit IPv6 addresses are actually the same thing in both codebases. There should not need to be some…

Are you not aware of the networking TS and the asio / boost::asio library its based on? Those have asio::ip::(tcp|udp)::address, both v4 and v6 iirc. Not sure if I'm missing something?

Re: Trip report: Summer ISO C++ standards meeting in Varna, Bulgaria

#75
post #53
post #46

Earlier quoted context omitted.

I'm not sure that's the flex you think it might be. At least, I interpret it as saying there isn't much publicly available Rust code, and only a few places to find Rust code. I have a hard time even estimating how long it would take to test a change against all publicly available C++ code. FWIW, the C++ standards developers use do use code search tools to help identify possible breakage.

Pretty sure from a build system perspective its quite a flex .. to be fair.

I understand the intent of the flex, but if true, it suggests there's very little public Rust outside of packages that can be downloaded from crates.io and a smallish list of alternatives.

By comparison, there's so much publicly available Python code, from so many sources, that no one can honestly say they can even find it all. The same for C++.

I've seen papers where the source code was included in the paper itself (eg, the FORTRAN code in Sibson's 1973 "SLINK" paper), or only distributed as a zip file from the author's web site, or in the supplementary data (eg, https://scholar.google.com/scholar?q=%22source+code+in+the+s... ) .

Personally, I don't think it's true. I suspect Rust changes - just like new proposed C++ changes - are checked against only easily and "well-known" accessible package.

Re: Trip report: Summer ISO C++ standards meeting in Varna, Bulgaria

#76

I feel things with C++ are not as bad as with Python, but I would really like a "core language freeze" for 10 years now or something. I don't want to keep up with all these changes. To many enthusiasts on the committee.

Any problem with C++ can be solved by adding more features, except of course for the problem of too many features.

Re: Trip report: Summer ISO C++ standards meeting in Varna, Bulgaria

#77
post #60

Earlier quoted context omitted.

That's a bad excuse. In fact I think editions are possible without modules at all, if you are really willing to fix this issue. Tying epochs to modules suggests that they don't think this is a huge issue to start with. One possible design is to assign editions to all preprocessed tokens. This implies the edition definition should be some sort of pragma (say, `#pragma STDCXX EDITION 2023`) and preprocessors should add…

> But I still argue that this design is simple, checks all checkboxes as long as open questions are decided, and can be independently deployed. You're handwaving a ton of complexity. You don't even need token pasting for this to become a confusing mess, just consider what happens if GUARD takes the name as an argument, or if an expression is constructed by putting two macros with different editions next to each other…

> just consider what happens if GUARD takes the name as an argument,

The name token will be assigned the edition of the originating position.

    #pragma STDCXX EDITION 2023
    #define GUARD(var) auto var = make_guard()
    #pragma STDCXX EDITION 2020
    GUARD(_);
    GUARD(_); // `_` is a normal identifier, so this will probably error.
> or if an expression is constructed by putting two macros with different editions next to each other.

Let's replicate the removal of implicit conversions from the Epochs proposal then.

    #pragma STDCXX EDITION 2020
    #define MOVE move
    #define LPAREN (
    #define RPAREN )
    #define COMMA ,
    #define P p
    #define LIT_3_42 3.42
    #define LIT_2_49 2.49

    #pragma STDCXX EDITION 2023
    void move(Particle&, float x, float y);

    void foo() {
        Particle p{};

        // error, all tokens are in the 2023 edition
        move(p, 3.42, 2.49);

        // depending on the proposal, at least one of them
        // should work because all constituent tokens for
        // the call expression are in the 2020 edition.
        // proposal authors would then be responsible for
        // which tokens are considered "constituent" here.
        move LPAREN p,      3.42,          2.49     RPAREN;
        move LPAREN p COMMA 3.42     COMMA 2.49     RPAREN;
        MOVE LPAREN p COMMA 3.42     COMMA 2.49     RPAREN;
        MOVE LPAREN P COMMA LIT_3_42 COMMA LIT_2_49 RPAREN;

        // assuming the call only regards `(` and `)` as
        // constituent tokens, the following call has
        // ambiguous editions and will fail to compile.
        move(p, 3.42, 2.49 RPAREN;
    }
So my chain of logic is that, we ideally want to put editions to the AST, but the existence of textual inclusion means that edition should also exist in tokens and the AST node's edition will have to be computed from them. Not a big deal for existing compilers (they already track spans).

> what happens with headers that don't care about editions, and only begrudgingly even include an extern "C" for C++ users?

For this reason I believe the edition should reset across files, reverting to the default edition.

And in fact this feature will benefit both C and C++, and thus ideally be harmonized. In this way we will no longer have to special-case some files to be implicitly in the `extern "C"` block! (Yes, this exists, see for example -internal-externc-isystem in clang cc1.)

> Suppose you wanted to remove most vexing parse in a new edition: changing the result of `Foo bar(std::array())` is the goal!

Now this is probably a better question, because we have tons of options for how existing parsers should behave. Note that I've intentionally omitted this part because those options are only useful when the ambiguity arises, and I think they can be determined in the case-by-case basis.

But if you indeed want to remove the most vexing parse, it's mostly up to the proposal author's decision. I should note the following quote from ISO C++:

If the statement cannot syntactically be a declaration, there is no ambiguity, so this rule does not apply. The whole statement might need to be examined to determine whether this is the case. [1]

So the parser should have already produced two possible ASTs for the same token sequence in the first place and picked one of them, in principle. The proposal therefore will determine which token affects this decision---for example that may be `(` and `)` as in the call, or the whole `std::array()` sequence that can be parsed as a type-id. In any case the proposal will give a concrete and compatible algorithm to remove the most vexing parse in a new edition. You can't remove it in existing editions, and this is by design.

(Alternatively and probably more commonly, the parser may use a prioritized choice, i.e. trying to parse type-id first then initializer-clause if it fails. In this case parsing type-id may have to signal that some constituent tokens are of a new edition and backtracking might be needed. The proposal author would want to experiment with different choices of constituent tokens to ease the implementation. But again, parser should have already implemented backtracking so this should be not a huge cost.)

[1] https://timsong-cpp.github.io/cppwp/n4868/stmt.ambig (this is not exactly about the most vexing parse but both cases are using the same wording)

Re: Trip report: Summer ISO C++ standards meeting in Varna, Bulgaria

#78
post #69
post #62

Earlier quoted context omitted.

It's exactly the flex you might think it is. The point is not in the number, but rather in the fact that you can build and test almost all crates available on almost all supported platforms, regardless of how many there are, and with no human intervention. For C++, there's no registry to start with, but even if there was: there's no standard way of building and testing projects. So, a crater build like this is simply…

> For C++, there's no registry to start with That's not right, there are multiple . There's no single registry. You can use the vcpkg registry, for example - that holds all small and large libraries I've ever needed (even one of my own). They also come with a standard way to build them, of course (CMake targets). Have you done C++ development recently? I fear a large part of the C++ crowd may not be aware that packag…

I know about vcpkg but there's only 2k packages there. The point of the grandparent comment was that there's SO much C++ code / so many packages you can build in a crater run that it would be physically unfeasible.

The problem with vcpkg, just like with any other "ports" package manager, is that it's not maintained by the original authors of the code but rather by a separate community. It's a bunch of "ports", trying to standardise the builds and installs to a common format. Out of wonder, I looked at a few recipes, they seem to just install things for you, but you have no automated way to do a crater run still - since most of those libraries are header-only you will need to write library-specific code in each case to actually use each package; at least a single include. The tests are seemingly also not being run.

Re: Trip report: Summer ISO C++ standards meeting in Varna, Bulgaria

#79
post #78
post #69

Earlier quoted context omitted.

> For C++, there's no registry to start with That's not right, there are multiple . There's no single registry. You can use the vcpkg registry, for example - that holds all small and large libraries I've ever needed (even one of my own). They also come with a standard way to build them, of course (CMake targets). Have you done C++ development recently? I fear a large part of the C++ crowd may not be aware that packag…

I know about vcpkg but there's only 2k packages there. The point of the grandparent comment was that there's SO much C++ code / so many packages you can build in a crater run that it would be physically unfeasible. The problem with vcpkg, just like with any other "ports" package manager, is that it's not maintained by the original authors of the code but rather by a separate community. It's a bunch of "ports", trying…

That's fair - but since this is about core language changes, compiling the non-header-only libraries already covers most of the commonly used libraries. Libraries like boost will also use most existing C++ features. I can't think of a single feature boost doesn't use, actually.

Re: Trip report: Summer ISO C++ standards meeting in Varna, Bulgaria

#80

Earlier quoted context omitted.

You have to think about newbies too. Python has made the same mistake as C++, but worse. At least C++ is not pretending to be user friendly. "Modern" C++ was a mountain to climb for me. I think I will not even try to catch up on modules, contracts and what not. I'd rather go back to C for personal projects. I just don't have the stamina for another big C++ language change. And they add up.

I don't understand this complaint even a little bit. Don't use features you don't want. If you want anything from C++ use just that. No one is going to put a gun to your head and make you #include when all you wanted was C with Classes.

That only works as long as you're the sole developer working on a project. When enough programmers work on a project, each using their preferred subset of C++, the whole language ends up being used (including C). Refusing to learn features beyond one's preferred subset usually isn't a tenable position.
Post reply on HN