r/cpp • • Dec 13 '19

The situation of std::embed...

https://thephd.github.io/full-circle-embed
238 Upvotes

160 comments sorted by

View all comments

202

u/James20k P2005R0 Dec 13 '19 edited Dec 13 '19

The C++ standards committee process is insane. That fact that std::embed (completely reasonable functionality that people have been asking for since as long as I've been programming) gets this kind of feedback, but, say, 2D graphics (which nobody wants) is just fine and dandy and we might get a whole TS for it

2D graphics is actually broken. I did a massive review of it (which seems to be stuck in limbo between being finished and putting it wherever papers go to be ignored, which i need to chase up on) and found that its broken. Like incorrect on multiple basic technical levels. Its factually wrong. It didn't take me long to find multiple glaring errors, and I wouldn't describe myself as a graphics wizard. It is obvious that the people writing the graphics paper do not understand graphics, and that criticism of the paper has gone completely ignored

The response from committee members in the case of std::embed seems to be "why would we want this", and yet the response for 2D graphics seems to be "you must prove that people don't want this", with feedback to criticism often genuinely bordering on childish or facetiousness. There's a huge double standard for the level expected around some features that I don't understand, or well..

There's three fairly major problems, as a totally external observer, that I've noticed with the standardisation process. The disclaimer here is that this is totally speculation, as I am not even tangentially involved in the committee process

  1. The process is relatively combative. Some committee members do not provide... constructive or productive commentary, and seem to be unfortunately quite ego driven. Instead of trying to help or engage with proposal, often lazy retorts are used or very general uncounterable points which can be poorly thought through (eg this entire circle business). Emphasise on some though, lots are very lovely and helpful. Graphics has been done to death elsewhere, but its a good case study of committee process gone insane

  2. The actual process itself is insanely exclusionary. There are tonnes of technically adept C++ programmers who are completely excluded due to its format. There's no reason to believe that the current standards committee members are good (or that they're bad), just that they happen to be able to do standards committeeing thing and comply with the demands it places on your schedule and finances - which is vastly different to the way most open source projects or languages work

  3. Some standards committee members are quite famous, which leads to their feedback or proposals being given a high weight. Some proposals proposed by well known committee members often garner a lot of attention over proposals proposed by people who are less well known. 2D graphics alludes to this, stating that the only time it was voted against was when the authors were not present in the room, which is a very odd way for a proposal to progress. I suspect that this makes it harder to kill bad proposals

The whole process needs a massive revamp so that 1. Your finances and location have nothing to do with your ability to propose features, critique proposals, or potentially even vote 2. Proposals are seen as a communal effort rather than an author vs the world mentality with good faith on all sides, and 3. Scrap the paper format entirely

Rust is a really interesting example here - not that all of rust is good, but eg see the way that async was dealt with. It was a communal effort with multiple competing ideas (not authors!), where people were collaborating to attempt to find the solution to a common problem, with the whole community at large able to engage on a sane platform (the internet!) with no financial locational or fame constraints

This is so antithetical to how C++ works, and its by far the largest reason why I potentially want to jump ship to Rust one day. This more than anything else is why I personally suspect Rust will probably win out in the long term in terms of new project adoption, although its still a long ways off that point

55

u/[deleted] Dec 13 '19

I don't know if I'd agree with 'just fine and dandy'. I don't think 2d graphics has made it to LEWG, much less gotten close to being in a WP. You just hear about it a lot because some of the folks proposing it are 'loud' and influential

76

u/James20k P2005R0 Dec 13 '19 edited Dec 13 '19

You're right - there was a vote against it, but its definitely not dead and its still being actively pushed and worked on. My main concern is that it should never have gotten anywhere to begin with, and it absolutely should not have any support behind it. Right from the beginning, Cairo was a genuinely terrible choice for a starting library, and much of the motivation for why it was picked legitimately does not make any sense

I do not understand how its managed to get anywhere at all with so many catastrophic issues attached to it, or how its even able to be pushed still

As a quick example, here are some of the issues that I have discovered

  1. All the colour constants are wrong

  2. All the texture formats are wrong

  3. Fixing the texture formats as-is requires non standard functionality, which this paper explicitly eschews

  4. Linear colour and sRGB are used interchangeably (a major error!)

  5. The definition of premultiplied alpha is incorrect

  6. Premultiplication is probably unusable as-is

  7. The reference implementation is completely wrong in multiple wide ranging ways, and is tested exclusively against its own output (which is incorrect)

  8. Subpixel font rendering is potentially unusable in some cases due to being optional, as well as blend mode issues

  9. Native interop is essentially unusable and should likely be removed

  10. Blending is specified to be as-if linear, but its not clear what should happen if the underlying hardware or drivers mean that the implementation cannot provide this guarantee (driver support can be spotty for eg sRGB textures) in a high performance or non precision losing way

These are 'just' the straight up technical defects - ignoring all the issues around performance, API usability and design, safety (we managed to make a 2D graphics library which is thread unsafe), and everything else! Many of these issues have been present since its inception or completely not noted so far, which has put a major dent in any faith that I have that the people who've been voting on it have really reviewed the work

There are other rather comedic issues as well - eg due to a big API design issue, the only portable way to transfer a file from a GPU to the CPU to poke at the pixels directly is... to save it to disk as a png/etc, then manually parse that png off the disk and decode it. This is probably unfixable in a sane way too due to the way its designed

I'm just so baffled all the way through, I don't know how we got here

33

u/erichkeane Clang Maintainer(Templates), EWG Chair Dec 13 '19

Committee papers are never dead until the authors (and any potential authors) say they are. The 2D graphics study group exists, but the proposals have never received positive votes in the evolution groups.

The reason it is still around is that there is people willing to work on 2D graphics, not necessarily that it has any 'life' to it.

9

u/James20k P2005R0 Dec 13 '19

Standardisation is not my strong suit so feel free to correct me if this is incorrect, but as far as I'm aware:

February 2017, Kona, LEWG [It was a few months before this meeting that this author joined the project.] There was further discussion about error handling, color stops and factory objects. The big advance was that the API was now stateless. “Are we comfortable moving the paper to LWG for a graphics TS once these concerns are addressed and we’re happy with the wording? 1|8|3|1|1”

July 2017, Toronto, LEWG Sadly, the notes are rather incomplete for this session. This author’s recollection is that the general gist was “still not quite ready”. However, the one recorded poll was “Do we want graphics support in a TS? 9|3|0|1|0”

With it only being

March 2018, Jacksonville, LEWG

Where the poll was

A poll was taken: “Should the paper be advanced to LWG? 1|3|3|3|2”

It seemed to be pretty positively reviewed in sg13, and then lewg for a while! But again I may be fundamentally misinterpreting what you mean, so feel free to correct me

12

u/erichkeane Clang Maintainer(Templates), EWG Chair Dec 13 '19

The first two votes are toward a TS, which is a MUCH lower bar than the standard. Note that the std::embed paper is not being pushed towards a TS, so if anything, its quite a bit ahead of 2D graphics.

That Jacksonville vote is negative.

SG13 is a graphics sub-group, so it is self-selecting. I know for a while the attendance was not much more than the authors/fans of that 2D graphics proposal. My understanding is that the 2D graphics has since been rejected, which is why web_view has been proposed as a replacement. However, my knowledge of the library side is lacking.

4

u/James20k P2005R0 Dec 13 '19

The first two votes are toward a TS, which is a MUCH lower bar than the standard. Note that the std::embed paper is not being pushed towards a TS, so if anything, its quite a bit ahead of 2D graphics.

Indeed, but still that none of the copious mistakes and errors were noticed is what concerns me

That Jacksonville vote is negative.

Sure sure that's what I meant, that there were a few positive meetings before it went to ambivalence

My understanding is that the 2D graphics has since been rejected

I have no idea, that said I was asked by someone to write the paper about 2D graphics due to concerns it might still be on track to standardisation, so it might not be as dead as we hope

Edit: Typos. I should sleep instead of doing this!

8

u/erichkeane Clang Maintainer(Templates), EWG Chair Dec 13 '19

Papers aren't dead until the author has given up :) However, any paper that provides an alternative or points out issues with a paper like this is typically given at least equal time at the meeting (typically at the same time) and can severely change how the committee votes.

I will note that http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2019/p0267r10.pdf was seen at Belfast, Nov19 by SG13, so it perhaps has some life left. In the meeting, no vote was taken (though the next meeting expects a revision). The author was suggested to gain feedback from the authors of : http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/p1062r0.html .

If you have issues with either, I'd very much suggest you write a paper critical to them. While it would be best to show up, there are quite a few people interested in this that could likely champion for you.

5

u/James20k P2005R0 Dec 13 '19

If you have issues with either, I'd very much suggest you write a paper critical to them. While it would be best to show up, there are quite a few people interested in this that could likely champion for you.

Yeah the paper's all done which is where other points in this thread come from, its worth noting that all criticism of 2D graphics so far has been pretty much dismissed, and concerns largely ignored - right from the very beginning. There's already been lots of papers pointing out that the direction is extremely suboptimal unfortunately, but they don't seem to stick!

8

u/erichkeane Clang Maintainer(Templates), EWG Chair Dec 13 '19

Has LEWG seen those papers? SG13 might not be as receptive to the criticisms (though perhaps more so now?), but LEWG would perhaps be not a self-selected group.

→ More replies (0)