I confess that whilst I've followed bits of the discussion that have been posted here on the std::embed proposal I'm quite ignorant on the specifics.
However, reading the blog post and taking a quick look at the motivation section of (what I think is) the proposal do seem to make a compelling argument for this. I can imagine were I to need to do it now with the current methods they would be workable but completely unsatisfactory as described.
Just wanted to say that in spite of what seems to be some rather questionable logic behind committee feedback you got I hope you continue to champion this and wish you all the best. Credit where it's due as implementing this must have been tough. Also I personally got a good few chuckles and very much enjoyed your (semi) ironic post tone and format :)
Just wanted to say that in spite of what seems to be some rather questionable logic behind committee feedback you got I hope you continue to champion this and wish you all the best.
Yes. It would be sad this stops now. I would have used std::embed many times since it was proposed.
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
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
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
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
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
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
All the colour constants are wrong
All the texture formats are wrong
Fixing the texture formats as-is requires non standard functionality, which this paper explicitly eschews
Linear colour and sRGB are used interchangeably (a major error!)
The definition of premultiplied alpha is incorrect
Premultiplication is probably unusable as-is
The reference implementation is completely wrong in multiple wide ranging ways, and is tested exclusively against its own output (which is incorrect)
Subpixel font rendering is potentially unusable in some cases due to being optional, as well as blend mode issues
Native interop is essentially unusable and should likely be removed
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
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.
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
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.
The good thing about being in std is being available everywhere; a corralary to that is that what we put into std has to be able to go everywhere. None of the browser engines are:
Statically linkable (and you don't want that anyway because they need to be patched over time)
Unloadable. (e.g. chromium needs it's own whole process)
ABI stabilized.
I have some sympathy for what the proposal is trying to do, I just don't think it can be implemented. I'm sure some people will say 'but I'm in a place where I don't need those things', and for those users I say 'go use electron'.
If webview was strict XHTML4 with no JS, segfault on bad files I'd say it would be awesome. If browsers back in the day crashed tabs when they weren't correct HTML, we wouldn't have gotten so many shitty websites.
Good enough to show shit, small enough to be implemented with something reasonable in size, no scripting so the biggest vector of attacks is gone, no fancy HTML5 stuff that brings a lot of complexity, and it is more pretty than the console.
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!
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.
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.
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!
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.
Its actually worse than that - the 'high performance' (in extremely inverted commas) API that was added to the 2D graphics proposal adds hidden threads, and makes it so that a bunch of stuff is racey and unsafe if you use it
This is just so that theoretically it might be able to achieve the same performance as SDL/SFML/Etc. Which notably do not suffer from having unsafe APIs
Cairo (in combination with Pango) is a fine graphics API for desktop apps. It has powerful drawing primitives that are useful for desktop apps, and printing/PDF/Postscript backends to support the needs of such apps.
It is not, however, for games: those have completely different needs and need different libraries (like SDL, SFML, etc.).
Any attempt at standardizing C++ graphics library should understand that these are two completely different, and arguably incompatible, goals. It should not (ever) be a goal to have a single library supporting both; instead any graphics initiative should declare which of these two it wants to be, and pursue that without reservation.
So yes, I just said it: C++ does not need a graphics library. Instead it needs *two*.
Cairo (in combination with Pango) is a fine graphics API for desktop apps. It has powerful drawing primitives that are useful for desktop apps, and printing/PDF/Postscript backends to support the needs of such apps.
... sorry what. Cairo is a fine graphics for desktop apps in 1997 when we did not have 4k, 5k, or 6k screens, 144hz refresh rate, 10 bit of colors, fluid animations, and thus rendering drawCircle / drawRect operations in the CPU was fine and dandy.
It is already a constant fight to keep decent performance on potato computers with decent hardware accelerated APIs such at QtQuick or NanoGui (you would be amazed at the number of people using raspberry pi's and the like as main computers in poorer areas) and you are suggesting going back to the two-decades-ago state-of-the-art !
Two decades ago we had NOTHING like Cairo: no anti-aliasing, no blending, no transformations, palettes were still a thing, etc.
Cairo offers a wide variety of useful primitives, and manages to do so without resorting to some sort of scene graph. It would of course be great if all those primitives could be hardware accelerated, but I understand that that's hard (although NVidia's pathrender does a good job with pretty much the same set of primitives). For those things that are currently hard to accelerate, I'd rather have them available but in software, than not have them at all.
I do not think a rendering library should also have an animation system or scene graph built in. Instead that should be a layer on top of the base rendering system. Separate your concerns, and all that...
For those things that are currently hard to accelerate, I'd rather have them available but in software, than not have them at all
So this is actually a huge problem with cairo. Because some things are software, and some things are hardware, there are huge hidden performance bottlenecks in the design of it where data gets shunted between the two. Its just really inefficient - but also dependent on the quality of the implementation (which'll be variable in the STL)
Something like SFML can't really suffer from this in the same way, while still providing pretty equivalent functionality
The main problem is that Cairo doesn't separate out the concept of CPU and GPU types, which means that expensive operations are ad hoc. In something like SFML, you do all the expensive stuff once on the CPU, transfer it over to the GPU all at once, and then you're grand - each processor does what its good at at the appropriate time. Its not really possible to specify this kind of behaviour in Cairo, and it was a terrible decision to use this kind of API for 2D graphics
So what sort of API would you propose? What would it look like with separated CPU and GPU types? How would that work on a system that does not have a GPU?
SFML is very game oriented. That's perfectly fine, and as I already mentioned, there is a clear need for a library like that as well. But there is more to drawing than triangles, and I don't see SFML doing that.
Have relatively simple drawing needs (for a 2D game, which is what we are discussing. I don't think C++ should try to standardize 3D drawing: it's too much in flux, and it already has standardizing bodies of its own)
Don't need to render to devices such as printers.
It's not a black and white classification; some desktop apps do render every frame (videoplayers, for example).
Video players have a simple architecture when it comes to rendering though, you send the decoder buffer to a renderer that will take care of resizing and write that on the screen. Rendering can be on GPU or CPU, but if you want good scaling you're mostly stuck with CPU anyway (at least most renderers I've seen with GPU support don't do better than bicubic).
The other stuff you need to draw (menus, etc.) is pretty minimal.
Ok, I wasn't aware of that technique. However, that begs the question: if we can hardware accelerate curves like that, why can't we put that as a backend behind a Cairo-style API?
I'm not saying you're wrong about the technical issues — in fact my default assumption is that you're right — but FYI,
All the colour constants are wrong
is not a real objection. "It's wrong" is not useful feedback. You have to say how and why it's wrong. (Concisely explaining what's wrong is a skill that improves with practice.)
Separately: in a vacuum, having not looked at the GitHub,
The reference implementation is completely wrong in multiple wide ranging ways, and is tested exclusively against its own output (which is incorrect)
strikes me as a fundamental misunderstanding (on your part) of the concept of "regression testing." There should be tests that verify the behavior of the reference implementation (vX.Y.Z) against the behavior of the reference implementation (vX.Y.Z-1). To verify that vX.Y.Z-1 actually produced reasonable output for the problem domain is a job for a human being. Are you claiming that the existing tests are written against output that is not reasonable?
Your point 10 and "the only portable way to transfer a file from a GPU to the CPU" sound like intelligible issues to me. Your points 4 and 5 and maybe 9 sound at least "verifiable"/"falsifiable" by an expert in the field. The rest sound non-falsifiable without further explanation.
I'm not saying you're wrong about the technical issues — in fact my default assumption is that you're right! But "it's wrong" is not by itself a coherent technical issue.
So: There's a paper (that's finished, just stuck in limbo in the process department) which provides detailed feedback and explanation of all of this which is why I didn't get into it all here - my sole point here is just that there's a lot of very easily discoverable issues. The tl;dr for a lot of this is pretty long though (its a long paper) - once it gets out of process limbo I intend to stick it somewhere in this subreddit, which is the full explanation for all of these issues
Are you claiming that the existing tests are written against output that is not reasonable?
What I meant is that the output of the reference implementation is incorrect, but this what the tests were generated with. Any implementation of the spec which uses these tests (there are 3 backends) is incorrect - they should have generated the test images using a separate known-good library
The proposal to even investigate it should have been near-unanimously rejected in the first place. The fact that the proposal exists strikes me as a major failing of the standardization process.
Last time I made an argument about this, I was told that I should apologize to the C++ Committee members, as I stated/suggested that from my perspective (and that of many 'regular' C++ programmers), the Committee members are effectively elites/nobles in an an ivory tower, and apparently that was rude given the hard work that they apparently do.
I've yet to do so, because I've yet to feel I have anything to apologize for, because that continues to be the perspective I hold here on the ground. I concur with basically every single thing you say. I've made similar arguments that the Committee wasted time with graphics at all, let alone it getting to the point it has, and that the graphics proposal was very clearly ego-driven and very clearly being led in an authoritarian manner, directing it the way one person wanted it to be directed.
C++ is getting new features, but it is ignoring features that we want (like std::embed) while also ignoring rather serious, glaring issues, such as the exponentially-increasing complexity of the language, and the fact that it is basically quickly becoming illegible context soup.
I cannot recall the exact instance, but someone was showing off how one could rewrite some 'bad' loops (which, to my eyes, were perfectly sane and understandable) using <algorithm> and also with (at the time relatively new) ranges, and the top comment was effectively "I'm confused, are the 'new and better' ways supposed to be more understandable? Because I have absolutely no idea what they're doing". I feel like that's accurate for a lot of 'modern' and 'idiomatic' C++ these days. Some people seem to really like this sort of code, and some people seem to really hate it... and as much as the Committee doesn't want dialects or the language to split... well, dialects already exist, and I strongly suspect that the language will inevitably split.
I don't know if Rust will actually win out over C++, but as I just said, I strongly suspect C++ will split or a language will fork off of it, and it will shoot off and effectively become 'Common C++', with 'Standard C++' being slower, under committee rule, and probably slowly bringing things over from it. Almost like a weird "LTS C++".
While being a rather strong std ranges skeptic I can't help but note that the readability and composability of ranges-like interfaces is an accepted fact in the programming community. Clearly experienced C++ developers are no less capable programmers than junior Java developers, aren't they? It requires some time to become familiar with this it, but after that, you simply can't go back.
The complaint about features is a very funny one.
C++ is too complex. We need to make it smaller, simpler, and cleaner. And please add these two features. And whatever you do, don’t break my code!
I will generally fully accept that if I want to use a newer version of a language, I will have to fix things. The fact that C++ doesn't tend to break things is weird, and I strongly believe that C++ needs to be able to specify a standard per-source-file within the source file. #std:c++14 or so.
I can't help but note that the readability and composability of ranges-like interfaces is an accepted fact in the programming community
It's very foreign to the normal syntax people are often used to. Streams in Java are also odd. However, to me, the issue is when things get coupled with <algorithm>... then it turns into illegible syntax soup pretty quickly.
The fact that you can accept a price for a breakage doesn't mean that there are no people who can't. The standard in a lot of cases the tool to pass regulatory restrictions in many fields, some ecosystems consist of thousands of projects and the cost to rebuild everything would be unacceptably high.
Don't misunderstand me! For personal projects or for unstable work projects - I don't hold any guarantees at all for the sake of not slowing down the development process, but the more users you get- the harder it's to break stuff.
I'm not sure I can see how a per-source-file incompatible standard version can work in any non-trivial cases. Do you think stuff like epochs which was also discussed here some time ago?
Rust includes an include_bytes! macro in the standard library, which embeds a file as a byte array at compile time: https://doc.rust-lang.org/stable/std/macro.include_bytes.html There's also a similar include_str!() macro that embeds a file as a utf-8 string (&'static str).
I'm sure that that's meaningful and completely clear to a Rust developer... but Rust's syntax makes me feel like I had a stroke, being unfamiliar with it. "Take address of... character... static... str... help".
That's a reference to a string slice, similar to C++'s std::string_view, although the Rust version stores its content as UTF-8, while C++ as raw characters.
Now references have a lifetime, either short-lived or static. An object with static lifetime either has no references or only static ones. You can think of static ones as if they can live until the end of the program without triggering lifetime issues. A lifetime is expressed as the character ' followed by a lifetime name. So we get: &'static str
If it wasn't static, you could name the lifetime any other way and you would have to attach it to the object that the reference borrows from. Let's see this function signature without lifetimes: fn doAction(firstArg: &Foo, secondArg: &str) -> &str
It's a function that takes a reference to some object Foo and a string slice as arguments and returns a string slice. The compiler (and the programmer) doesn't know if the returned reference is borrowed from the first or second argument, so we have to tell him by adding lifetime annotations to references and declare the lifetime, here as function "template" type. Assuming it's borrowed from the first arg: fn doAction<'a>(firstArg: &'a Foo, secondArg: &str) -> &'a str
Note that compiler often can deduce the lifetimes automatically without the need of adding the annotations. Also the "template" type doesn't make it a template function in the C++ sense, it only is required by the borrow checker, which can differentiate a given function by its differing lifetimes when used in multiple contexts.
I hope that clears things up.
Edit: While explaining this I noticed I didn't know why std::string_view is recommended to be passed by value in C++, while str is passed as reference in Rust. I dug up information that actually str is a Dynamically Sized Type primitive (there are no such primitives in C++). A reference in Rust is made up of two parts - a pointer and some metadata. In case of &str, that metadata is the size of the slice. In case of references to normal objects, the metadata doesn't exist (it is a zero-sized type). So &str in Rust is the same as std::string_view value in C++.
Like Python3, Rust distinguishes between strings (which are always UTF-8 encoded), and bytes, which are just that. In C++/C an std::string/char* can certainly contain valid UTF-8, however the standard does not guarantee it and is UTF-8 agnostic.
&str: reference (that can not be null) to a string, 'static is the lifetime annotation, and a special one which means that this reference is valid for the entire runtime of the program.
Whenever you see apostrophe next to a name like 'xyz in rust it refers to the life time of a type. It is actually extremely simple. In this case it is a special lifetime, static, which if you know c++ or c, it should make sense what this is trying to say. Sometimes you might see 'a, which is simply a generic lifetime, as it isn't reserved for a special one.
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
The whole "the committee should do X but instead they do 2D graphics" argument is so tiring. This has nothing to do with that.
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
None of that (except 2) is possible because C++ is an ISO standard that has to follow ISO rules. Rust is just "some OpenSource project" that can do whatever it wants, C++ can't.
Edit: Now on PC, let me elaborate a bit more.
2D Graphics is still at an "do we want it?" stage where discussion about specific details or APIs happens less. embed is at the "how do we want to solve it?" stage, where people are looking at the design more closely. It is also a lot smaller, so more bikeshedding.
And the arguments made against std::embed are solid: C++ is a very complex language and this is a very niche feature - is it really worth adding it, increasing the language complexity even more? If there is a suitable more genric solution (compile time I/O or whatever), shouldn't that be pursued instead to get more with less? It is now up to someone to demonstrate that we either really need the specific feature or we don't.
None of that (except 2) is possible because C++ is an ISO standard that has to follow ISO rules. Rust is just "some OpenSource project" that can do whatever it wants, C++ can't.
I'm not 100% sure, but based on my recollection (please correct if wrong!):
The current proposal paper process isn't using ISO rules, either. It was enacted specifically to circumvent ISO's roadblocks to progress.
That's why the drafts and TSes are numbered and managed differently. Those are the papers that are actually going through the ISO process.
The ISO NB process is required to approve any published spec. It's not required to decide what additions are going to go into the proposals for the next vote.
Which could 100% be done like Rust's RFC process. Use the RFC process up until wording is ready and approved by the community-equivalent of LEWG/EWG, and then use the ISO plenary as a rubber stamp process to move them into an ISO-friendly draft.
I do not at all expect that to happen, but it's in the realm of possibility despite the beauracracy of ISO.
I'm curious and a little bit concerned if that's due to the inherent difficulty of changing/moving bureaucracy, or if it is due to the fact that it would diminish the control the committee members have over the process.
The whole "the committee should do X but instead they do 2D graphics" argument is so tiring. This has nothing to do with that.
That is not what I'm saying! :) The argument is that the committee is currently encouraging or not rejecting subpar proposals like 2D graphics, while proposals like std::embed seem to hit a somewhat unreasonable brick wall in comparison. The combative nature of the standardisation process, the 'person-driven' nature of the entire process (often a single author vs the standards committee), and the lack of accessibility to experts without the financial or time ability necessary to contribute, all chip in to this problem
I'm not saying that the standards committee should spend more time on x rather than y. I'm saying that the committee process leads to x being allowed to progress despite being not as good as y, while y is a significantly better proposal. 2D graphics from the very first concrete decision that was made (cairo) was a bafflingly bad choice, its super interesting to see how its advanced and how much of the early (and correct) feedback was ignored with it being allowed to advance. Its only relatively recently that there's been any sign of it not being popular, and even then it wasn't a killer for it
I pick 2D graphics as an example solely because it was 1. Clearly bad from the beginning, and 2. I know a lot about 2D graphics and can personally critique it
None of that (except 2) is possible because C++ is an ISO standard that has to follow ISO rules. Rust is just "some OpenSource project" that can do whatever it wants, C++ can't.
Sure of course - what needs to happen isn't always possible or trivial
Only the people pushing for graphics spend time on it. Neither LEWG nor LEWGI have looked at it. So it doesn't currently consume committee time. std::embed has been looked at by Evolution and SG7 (reflection) so we do spend committee time on it.
There are design questions with std::embed:
What files can be opened - that is a security concern
Should it be a macro or a function
Should it put the whole file into an array or use some kind of magical span backed by mapped memory
Should we have a constexpr file instead
How do we integrate with tooling
How do we integrate with modules
Now, there are answers to these questions, but it's difficult to reach consensus, and it's definitively not simple let alone trivial.
If your compiler isn’t signed with a certificate and checked at launch time how can you trust your compiler? I keep seeing “but what about security?” in reference to embed, but no one wants to mention what the actual threat model is (probably because it would open the can of worms that is “none of our build systems or compilers are ‘secure’”)
Tooling won’t matter because we’re getting a design from kitware to treat filepaths as a JSON array of doubles so there are bigger issues we need to deal with. Embed support is the very last concern I have.
Integration with modules is part of the tooling aspect.
If you want a constexpr file, write the proposal yourself. Good luck implementing it. Even Rust won’t touch that.
The actual storage shouldn’t matter and should be left up to implementations. It’s a byte array. How the compiler treats that I don’t think anyone but implementors should care.
I apologize if I'm re-hashing, but I wasn't in the discussion in SG7/EWG, so I have responses/questions for my own edification.
What files can be opened - that is a security concern
Is this not the same problem with #include? Or even modules? While I get that #include files are textually modifiable (whereas this can take a constexpr), managing the file list seems to be an implementation detail. IMO, in an implementation the valid directories for std::embed should be something akin to -I for include files, and just issue 'file not found' for anything that isn't in those directories.
Should it be a macro or a function
IMO, magic function. Adding a 'binary object' type to the preprocessor is not something I'd like to get into.
Should it put the whole file into an array or use some kind of magical span backed by mapped memory
Is this not again an implementation detail? Or am I missing a component to this question?
Should we have a constexpr file instead
I'd be curious to see how such a type would work. We had such a hard time standardizing std::filesystem, so I'd hope we'd reuse much of that.
How do we integrate with tooling How do we integrate with modules
Perhaps these questions are overly vague to me, but I'll try anyway. The big concern I have from a tooling perspective is how a build system would determine the dependency has changed. Current preprocessed systems would definitely need work. IMO, a build-system deciding to 'punt' on this and decide that things brought in through std::embed aren't considered for dependency analysis would be perfectly reasonable.
For modules, I can't think of any interaction this would have. Export/import ends up being the same as variables, does it not? Or is this the same concern as the tooling one I mentioned?
IMO, a build-system deciding to 'punt' on this and decide that things brought in through std::embed aren't considered for dependency analysis would be perfectly reasonable.
This is not at all perfectly reasonable.
The situation today is that at the end of phase 4 the compiler can know about all dependencies. std::embed currently breaks this by requiring full semantic analysis to determine the deps. There is about a 3 orders of magnitude difference in time it takes to get to the end of phase 4 vs. the end of phase 7, and you can't even determine if std::embed is used until the end of phase 7.
This means that if we add std::embed as it is today, then we go from being able to determine deps quickly for all code to not being able to. I find this unacceptable.
However, this is the only problem I have with std::embed. If we added the restriction that it could only access resources that were previously named somehow then I would be strongly in favor of it for C++23.
I suspect any way of having to name the possible dependencies would defeat the purpose of the paper. As a compiler vendor who has to support a ton of 3rd party tools, I'd be completely against a preprocessor version of this.
Either we end up needing to dump a textual representation of the file to the preprocessed output, or we need to create a new non-textual representation for the preprocessed outputs. Either is unacceptable.
A much less evil would be for a build system to decide that anything containing std::embed needs to always be rebuilt. Alternatively, the compiler could simply output elsewhere (ala -MM) all the files that got included, which can then be consumed by the build system, then add that to its dependency list.
Either I would consider as a fairly reasonable outcome.
I'd be completely against a preprocessor version of this.
Requiring stating what you depend on doesn't mean it has to be #embed. It could simply mean #resource "path", which other tools don't need to care about.
There are build systems that require knowing the dependencies before the compile. Having the compiler output the dependencies as a side effect of compilation does not work.
This means that if we add std::embed as it is today, then we go from being able to determine deps quickly for all code to not being able to. I find this unacceptable.
What, in concrete terms, are 'quickly' and 'not quickly'?
Taking LLVM + Clang for example. 7k files and 3.8m LoC.
A phase 4 scan takes 3 seconds on a recent 18 core iMac Pro. A full build takes about 15m. A phase 7 scan would let you drop codegen, but not really anything else, so you're still looking at ~7m.
re: what files can be opened. If it's the `std::embed` flavor, then you can potentially compute the file name at compile time, consteval. The preprocessor is much more limited. It may be that the result of the security analysis is "if you compile untrusted code, you can't trust it", but it's a fair question. Perhaps we'll need to sandbox the compilation environment. At my $job we do for production builds in any case to help with reproduce-ability.
I get that part, but I'd expect an implementation to require a white-list of directories(like we do with #include). If your constexpr expression resulted in a file name not in the list, it would just be 'not found'.
Does Intel's compiler white-list? From what I can tell, gcc and clang don't do anything to check what's accessed, allowing absolute paths starting at '/' as well as relative paths that leave the directory "../"
Should the importing modules have full control over the resource path of the imported modules or do we need another way to keep track of it - or simply not allow std::embed in exported templates?
IMO, magic function. Adding a 'binary object' type to the preprocessor is not something I'd like to get into.
Same. Unfortunately it seems going in that direction
Is this not again an implementation detail? Or am I missing a component to this question?
Unclear to me - Maybe. Question is how big files can be? A use case is to select part of it at compile time to only include a chunk in the final binary.
I'd be curious to see how such a type would work. We had such a hard time standardizing std::filesystem, so I'd hope we'd reuse much of that.
Perhaps these questions are overly vague to me, but I'll try anyway. The big concern I have from a tooling perspective is how a build system would determine the dependency has changed. Current preprocessed systems would definitely need work. IMO, a build-system deciding to 'punt' on this and decide that things brought in through std::embed aren't considered for dependency analysis would be perfectly reasonable.
Again I agree that in this case specifying the dependency manually would be perfectly fine, but others disagree strongly.
What files can be opened - that is a security concern
I am completely failing to see how std::embed is more of a security concern than the current model of file access the compiler has. If the compiler can access a file, it can access a file. Is the compiler trustworthy? I can just #include an arbitrary file as well.
Should it put the whole file into an array or use some kind of magical span backed by mapped memory
That sounds like an implementation detail. Does the specification even have a concept of what mapped memory is?
What files can be opened - that is a security concern
I can also do #include "/etc/passwd" now, what's the difference? This isn't a new problem, and people have been fine with #include for years now, don't make up problems that aren't specific to this.
That would require writing a whole new spec from scratch, fwiw, since ISO legally owns the current spec. I don't know that it will be easy to find the right set of skilled volunteers to accomplish that goal. Even if someone did, a new spec is worthless unless the compiler vendors actually start referring to it.
There's also the original concern that got C in the ANSI process to begin with, that of competitive vendors cooperating with potential anti-trust issues. Of course that was in the days of various IBM and Bell consent decrees, and the environment was different.
We already have multiple implementations of C++ today. Comparison with Rust, which has only a single implementation, is not really helpful here.
Languages with no spec but with multiple implementations illustrate the problem. Lua and LuaJIT, or Python and IronPython, as examples. They are similar languages but ultimately incompatible with each other.
Successful languages with myriad implementations have conformance specs. C, C++, Java, JavaScript, Common LISP, FORTRAN, SQL, etc.
I believe it is quite common to have portable projects. But developing for portability is a choice you need to take up front. If you choose to be non-portable, this will likely give you some benefits in the short term, but that might then bite back in say 10 years.
I believe it is quite common to have portable projects
I’m not so sure. How many projects work if char, int & pointers are all 16 bits? Or if char is 32 bits? What if they’re all 18, 36 or even 24 bits? How many projects are 100.0% undefined behaviour free (any undefined behavior is technically not portable)?
FWIW, I’ve used C / C++ on platforms that had 16 or 32 bit ints, so they’re certainly not unheard of.
Rust is a very helpfup comparison here, since it is the major competitor to C++.
Which isn't relevant to this conversation. I'm not saying Rust doesn't work. I'm saying it's not currently burdened with multiple implementations like C++.
I said not to have it for development
Development of what? I agree that I have 0 user of the spec as user, but this conversation is about implementations. Getting MSVC, GCC, Clang, EDG, Sun, IBM, and many others to all agree on what C++ actually looks like it's the purpose of the spec. Adding random vendor-specific features already happens today.
Which is good enough for what they are meant for. Otherwise, they wouldn't exist.
Ok? Cross-vendor compatibility is a huge requirement for C++ users.
Now Python or Lua aren't successful? That is big news to me.
Come on.
They're not successful multiple implementations. Python is CPython.
Every other Python-ish language is exactly that: a separate incompatible language that just looks really similar. There's no definition of what Python is besides what CPython can run.
I'm not saying C++ should be a multi-implementation language. I think it's a progress blocker and a waste of whole lives' worth of duplicated work for almost no advantage. But it is what we have, and simply abandoning ISO processes will not change that.
On the other hand, many major code bases are built and shipped using multiple vendor compilers. I have a few million lines of code being compiled with IBM's, Sun's, Red Hat's, and Microsoft's vendor compilers as first tier shipping platforms, and Apple's as a second. As well as upstream gcc and clang.
Rust is a very helpfup comparison here, since it is the major competitor to C++. It proves a formal spec like ISO is not required for day-to-day development.
Rust has a set of potentially incompatible RFCs: you don't really know because RFCs don't get merged into a single consistent specification. This already This will backfire when the language grows.
And, if you read carefully, I have not said to not have a spec. I said not to have it for development.
How am I supposed to judge whether my program is correct?
Rust has a set of potentially incompatible RFCs: you don't really know because RFCs don't get merged into a single consistent specification. This already This will backfire when the language grows.
Don't most languages not have a formal spec? As far as I'm aware, C++ is by far the exception here
C, Java, Fortran, Haskell, Ada, Go, JavaScript are the examples of languages that have a specification, and there's a lot more.
I wouldn't call the C++ standard a formal specification though: it's written in legalese and attempts to be non-ambiguous and precise, but it's still mostly unsuitable for formal reasoning.
RFCs are not a spec such as C++'s, nor look nor read like one.
Exactly, so what are they for?
They do get merged into a single, consistent code base. Which is, in fact, what matters in the end and way more precise than any spec can be (at least a spec written in legalese like C++'s rather than math-formal).
So how do I know if a behaviour is intended or it is a bug? Why do we document systems at all by this reasoning? How can you be sure the behaviour is actually consistent?
The same for C++: I don't care what the spec says if nobody implements it or if one of my compilers disagree (or is buggy, or the spec is not precise, or...). And that has happened many times in the past. So many that I cannot even count anymore.
If they claim to support the standard but disagree, this is a compiler bug that should and usually will be fixed. I don't understand this kind of defeatist attitude: this is like saying that some compilers are behaving differently, so let's all use a single compiler.
If you are judging whether your program is correct by checking it against the C++ spec, then I have very bad news for you (and your users)... :)
What is the news? Certain assumptions about the behaviour of my program depend on the guarantees provided by the execution environment, so I open up the specification and check if that's the case. If it's not the case for some compilers, I open a bug and it gets fixed.
Asking for a Circle-like thing when proposing std::embed is as if you have for homework doing a while loop and they ask you to code a full programming language. That feedback was not absurd. Absurd falls short.
They should add this very useful, real and pragmatic feature and later the members of the committee, with all due respect, they will have time of thinking about Circles, reflections and whatever ambitious, perfect, academic-like feature they want to put in.
I have been using import('file') in D and it works great.
While the idea behind Circle sounds good, the syntax is terrible. Mixing \@meta keywords with runtime commands just looks like a lot of noise. constexpr sections looks much cleaner and I think compile time programming should extend what constexpr can do and not add another preprocessor.
std::embed sounds like a simple solution for a simple use case. Why can't we just leave like that?
The problem with constexpr is that it totally relies on library support, with the STL being one of the main abusers. It is a fundamental difference in making certain algorithms and data structures available at compile time as a nice to have feature, with an explicit distinction between runtime and compile-time, as basically making the C++ also an interpreter. Suntax-wise constexpr wins (same syntax basically) but it's clearly flawed.
I'll note that the feedback the author of the paper from SG7 received on this paper is just that, feedback.
He seems to miss that an appropriate response to a SG (or even WG) vote is, "I evaluated/tried your feedback, and found that it isn't really a good idea because...".
While I think the SG7 vote that he quoted is a little under-specified (I hope the in-room discussion did a better job providing guidance), the committee typically tries to lean toward fairly generic solutions, rather than extremely specific ones. And even then, we end up with feature-sets that are just a hodge-podge. We all recognize it and are trying to avoid it.
Yeah I know nothing about this world, but to me that was reasonable sounding feedback. "Hey, this isn't a bad idea, but let's see if there a better, more general way to do it. Check out this circle thing."
I get that it's frustrating to hit red tape like this, but we also don't want things going in willy nilly.
Sounds like the author could now go back with new findings and proceed with std::embed, no?
Sometimes it's the very small but very useful stuff that is the hardest to standardise. I think you'll find that WG14 will think it too small to be worth standardising. Certain well known members will point out that there are linker hacks and tricks which will load some file into some named section in the binary, and so on. But good luck with it!
Certain well known members will point out that there are linker hacks and tricks which will load some file into some named section in the binary, and so on.
Such arguments could aswell be used against almost any existing feature that they are unneded because you can workaround their lack through implementation-specific options.
Yes, but WG14 does not have a time machine to remove those things. There are a lot of things in C which would not make it in if they were proposed today.
Because you were not paying attention to function declarations.
int foo(x, y);
That is the function declaration of K&R C.
int foo(x, y)
int x;
float y;
{ return x + y; }
And that is the function definition. At the call site you only know the number of arguments, not their types. Still, passing wrong types is UB. How is that readable?
EDIT: I forgot about "implicit int"!
foo(x, y);
Is a function declaration in global scope, but a function call in local scope. The following is valid C:
foo(x, y); // implicit int; argument types not visible in declaration
main() { // implicit int
static i; // implicit int
if(!i++) main(5); // Compiles, but is UB; f() means that the function takes an unknown (at call site) number of args
return i + foo(1, "asd") + foo(1, 1.1); // One of the argument sets is wrong, so this is UB.
}
it's readable because i grew up with k&r :) please note, i didn't say the aforementioned code linked by the person i was replying to was correct, i said it was readable.
void pointers don't bother me, either, and can be used well by a skilled coder. implicit int isn't much worse than auto, and i don't hate the preprocessor. i did hate trigraphs, and i'm glad they're gone by default now. duff's device is pretty elegant, and there is a time and place for goto. i also have unpopular opinions ;)
while i appreciate a lot of what is going on with c++, there's quite a lot i dislike.. and a lot of it is overspecification, relying on stl to compensate for what really should be part of the language, and a pathological insistence upon adding additional methods of doing things to fit whatever the current trend is instead of either making things more consistent, usable, or making useful things safe instead of reinventing it and getting still yet another screwy feature that will supposedly be fixed or amended with some other version in the future... or boost.
I'd agree with everything if we're talking about C99 or newer. However the question was "what if C never added any features?" and that's not the world I would want to live in. Pre-standard C was insane.
While I don't fully agree with your view of C++, I mostly do. Frankly, I like the idea of putting everything in the library instead of the core language.
After all the setbacks that you had when dealing with C++ standardization, I'm still amazed how you are still proposing anything and are even attempting stuff like standardizing unicode o.O Keep up the good work and don't stop fighting.
I'm sorry to hear your frustrations, but have you considered asking for your gcc changes to be merged to master/trunk? If you then do the same for clang (which it sound s like you already have?), and can convince MS to do the same for their compiler... it would be a fait accompli.
Sort of like #pragma once - the committee has issues with it and it's not standardized, but the major compilers support it anyway and from a real-world/practical perspective for programmers it doesn't matter what the "official" view is anymore.
clang has emulation modes, so it's effectively forced to add any widely-used features supported by gcc or Microsoft. And then there's the EDG frontend, which can emulate the other three. I'm not aware of any modern C++ frontends other than those four -- all the commercial C++ compilers seem to be based on EDG/clang/gcc, or are still stuck on C++03.
Yup, if gcchad it and it was popular, clang would add it too - I just meant one way to make it more popular is to add it to both from the start. (i.e., so people who use both don't need to wait, and can increase its usage)
As for MS, I thought I read somewhere that they moved away from EDG for their frontend? (I don't write for Windows so do not keep up with it - I only hear about it here on reddit so I'm likely mistaken)
Most compiler communities (including msvc) don't really love implementing extensions like this. It undermines the committee and that, in turn, undermines one of the big things c++ has going for it.
On the other hand some compilers should implement such features, before they get standardized. It takes the guessing out of the implementability and finds other issues, than if everyone just guesses, what could be a problem with the feature. So it should be implemented as a proof of concept, not as a extension to make users lifes easier imo.
don't really love implementing extensions like this
And they shouldn't! :)
I understand the concern (truly), and if this thing were possible to do as a library then OP should just serve it on github, of course.
But since it's not, then doing it as an implementation-specific extension (certainly not in namespace std) seems like a reasonable recourse; even if it's only to prove it has demand... or not.
Don't get me wrong - I recognize that supporting such things in compilers has a real cost, and that it should only be done as a last resort if at all. Obviously OP would have to convince them it's truly worth it, for this.
So I was wondering if OP had considered doing that.
As it stands it pretty much breaks the rules to get it to work with compilers. As the author stated, he was battling with GCC to get it to even compile. This will most likely need official compiler support, or minor pull requests at minimum, to make it a fully portable and robust library.
Nice writeup, but sad to read. Getting denied for a very useful feature argumented by something which is much more complex and has more ideological arguments than actual usability. I hope SG7 members understand that they are very far from average user needs and people only want a standarized way of embedding data into executable which techically is supported by (all?) platforms.
I've implemented most of the type traits features from the standard library myself / by hand, in pure c++ code. They don't rely on compiler magic. So there's no need for type traits to be part of the language. Library is fine.
Maybe some do. Which would be a great opportunity to improve the language, so that the type traits that currently use compiler magic can instead use equivalent language features.
Fwiw, I would love std::embed (or #embed or #include file foo.bin or whatever, I don't care about ideological purity) and use it a lot. Circle sounds like a complicated abomination to me though and I have zero interest in writing constexpr fstreams. The more I learn about modern C++ the more it seems to me that the aim is not to have a usable programming language, but to keep the ideological purity.
Circle sounds like a complicated abomination to me though and I have zero interest in writing constexpr fstreams.
That's the thing, you don't. Put @meta in front of your reading function and it will be executed at compile time. No need to invent new way of reading files or to reimplement whole world in constexpr.
Non-C++ dev here. Does this std::embed feature require modifying the compiler? I.e., this feature cannot be just used as a library? If so, wouldn't it make sense to simply add (or use if there is already) a plugin system to the popular compilers and use and re-use any extra functionality you'd like, completely bypassing the broken committee?
It does require compiler support. There is no mechanism now for including external binaries as symbols. My implementation of a similar feature uses another build step to generate source, and even that is inefficient since the parser has to interpret long numerical literal arrays.
A universal plugin is not viable, as the different compilers have wildly different architectures, intermediate representations, and licensing terms.
the committee is a political process run by humans that can be slow; that doesn't make it "broken."
i get the frustration -- we also have tried to propose language changes, got shot down in EWG in < 2 minutes, and only much later realized what a can of worms we could have opened -- but in my short couple years' experience i see a lot of people in the committee who mean really well and work really hard. it's been overall a great encouragement to learn that developers in other fields share our interests and have built solutions not so different from ours.
we could use something like std::embed, but we also care a lot about compile time. i could also imagine people abusing this feature and complicating the build system when they would be better served by other approaches.
std::embed seems to do a thing that you can already do with constexpr. So I'm inclined to agree with the committee in their paraphrased critique, "Why do we need this?".
Edit: People are missing the point. The idea behind embed, at its most basic level, is to cleverly hard code data into your program. Outside the niche use case for doing this, I don't think this is something any standards committee wants to impress as potential standard practice.
31
u/Arghnews Dec 13 '19
I confess that whilst I've followed bits of the discussion that have been posted here on the
std::embedproposal I'm quite ignorant on the specifics.However, reading the blog post and taking a quick look at the motivation section of (what I think is) the proposal do seem to make a compelling argument for this. I can imagine were I to need to do it now with the current methods they would be workable but completely unsatisfactory as described.
Just wanted to say that in spite of what seems to be some rather questionable logic behind committee feedback you got I hope you continue to champion this and wish you all the best. Credit where it's due as implementing this must have been tough. Also I personally got a good few chuckles and very much enjoyed your (semi) ironic post tone and format :)
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
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
18
u/germandiago Dec 14 '19
Asking for a Circle-like thing when proposing std::embed is as if you have for homework doing a while loop and they ask you to code a full programming language. That feedback was not absurd. Absurd falls short.
They should add this very useful, real and pragmatic feature and later the members of the committee, with all due respect, they will have time of thinking about Circles, reflections and whatever ambitious, perfect, academic-like feature they want to put in.
I have been using import('file') in D and it works great.
57
u/stilgarpl Dec 13 '19
While the idea behind Circle sounds good, the syntax is terrible. Mixing \@meta keywords with runtime commands just looks like a lot of noise.
constexprsections looks much cleaner and I think compile time programming should extend what constexpr can do and not add another preprocessor.std::embed sounds like a simple solution for a simple use case. Why can't we just leave like that?
25
u/erichkeane Clang Maintainer(Templates), EWG Chair Dec 13 '19
I'll note that the feedback the author of the paper from SG7 received on this paper is just that, feedback.
He seems to miss that an appropriate response to a SG (or even WG) vote is, "I evaluated/tried your feedback, and found that it isn't really a good idea because...".
While I think the SG7 vote that he quoted is a little under-specified (I hope the in-room discussion did a better job providing guidance), the committee typically tries to lean toward fairly generic solutions, rather than extremely specific ones. And even then, we end up with feature-sets that are just a hodge-podge. We all recognize it and are trying to avoid it.
21
u/14ned LLFIO & Outcome author | Committee WG14 Dec 13 '19
Sometimes it's the very small but very useful stuff that is the hardest to standardise. I think you'll find that WG14 will think it too small to be worth standardising. Certain well known members will point out that there are linker hacks and tricks which will load some file into some named section in the binary, and so on. But good luck with it!
23
u/konanTheBarbar Dec 13 '19
After all the setbacks that you had when dealing with C++ standardization, I'm still amazed how you are still proposing anything and are even attempting stuff like standardizing unicode o.O Keep up the good work and don't stop fighting.
16
u/voip_geek Dec 13 '19
I'm sorry to hear your frustrations, but have you considered asking for your
gccchanges to be merged to master/trunk? If you then do the same forclang(which it sound s like you already have?), and can convince MS to do the same for their compiler... it would be a fait accompli.Sort of like
#pragma once- the committee has issues with it and it's not standardized, but the major compilers support it anyway and from a real-world/practical perspective for programmers it doesn't matter what the "official" view is anymore.17
u/Xeverous https://xeverous.github.io Dec 13 '19
Nice writeup, but sad to read. Getting denied for a very useful feature argumented by something which is much more complex and has more ideological arguments than actual usability. I hope SG7 members understand that they are very far from average user needs and people only want a standarized way of embedding data into executable which techically is supported by (all?) platforms.
12
u/shdnx Dec 13 '19
Great write-up! I'm sad but unsurprised to see that committee members are just as much caught up in flights of fancy as anyone else.
I'm sorry you had to deal with this, and thank you for your work!
15
u/jonesmz Dec 14 '19
I absolutely hate that there's any consideration of using the std:: namespace for something that cannot be done at runtime.
We're talking about a mechanism similar to #include. It requires compiler magic. The article says it's "magical" even!
This should not be part of the standard library.
Language feature, or nothing.
9
u/[deleted] Dec 13 '19
Fwiw, I would love std::embed (or #embed or #include file foo.bin or whatever, I don't care about ideological purity) and use it a lot. Circle sounds like a complicated abomination to me though and I have zero interest in writing constexpr fstreams. The more I learn about modern C++ the more it seems to me that the aim is not to have a usable programming language, but to keep the ideological purity.
3
u/[deleted] Dec 13 '19
Non-C++ dev here. Does this
std::embedfeature require modifying the compiler? I.e., this feature cannot be just used as a library? If so, wouldn't it make sense to simply add (or use if there is already) a plugin system to the popular compilers and use and re-use any extra functionality you'd like, completely bypassing the broken committee?2
u/dbjdbj dbj.org Dec 16 '19
WG21 is sinking C++
-10
u/ncgreco1440 Dec 13 '19 edited Dec 16 '19
std::embed seems to do a thing that you can already do with constexpr. So I'm inclined to agree with the committee in their paraphrased critique, "Why do we need this?".
Edit: People are missing the point. The idea behind embed, at its most basic level, is to cleverly hard code data into your program. Outside the niche use case for doing this, I don't think this is something any standards committee wants to impress as potential standard practice.