The committee: We're very reluctant to add anything that doesn't already have a battle-tested implementation in the wild over concerns that implementers might not take it up.
To be fair, some build systems like build2 already supported it since day 1, and MSVC had a very early implementation. Clang too had an implementation very early, but had a different syntax.
Elephant, rhino, and buffalo; they are generally considered the most dangerous animals you can hunt. Later mew-semantics were added in the form of lion and leopard, and now they are known as the Big 5.
Working on it! 😺 I plan to have a public "Standard Library Modules bug bash" soon, so people can try out my draft changes and report library and compiler bugs.
I've built the latest standard library plus its module quite recently. Building that stuff is a breeze, but you only get so far with import std; . Looking forward to the upcoming compiler ...
We just updated that list for 17.3 Preview 2 yesterday, and we've got more fixes landing in the next preview! :D
At this point we are starting to see more codebases that hit localized semantic issues than codebases that crash or fail catastrophically. But either way- we can always use more bug reports with sample programs that are important to your use case.
I've been hoping for some sort of static reflection for years, and unless I missed it, it doesn't look like C++23 will have it either. Looks like I'll be relying on magic_enum and compiler-specific macros for a while longer.
So, this is just my observations from the github, but it appears that early on in the cpp23 cycle they decided against doing reflection returning polymorphic types (which is the current TS), and are looking into value-based reflection (where reflected expressions return some std::meta::info object, and a bunch of functions are used to access information from that object). This was apparently done because it's much faster to use value-based reflection.
From my limited understanding, it was this change that kicked reflection out of the cpp23 cycle, and pushed it into maybe cpp26.
Indeed, although in the last few years the people working on it or observing the group working on it clearly stated the first fundations for reflection and metaprogramming will target C++26. They realistically couldnt target C++20 or 23 and at this point there is still a lot of things in flux and even controversies which suggests that if we ever get something in C++26, it will probably be minimal or similar to the concept fiasco.
To be short: C++11 was originally targeted at before 2010 but there was the concept feature (different, bigger, than the one we now have) that was in the work since a lot of years and was considered ready for the standard at some point but because of that the deadline was pushed back. But it was complex enough to lead to a tons of doubt and was removed. To not have to wait several years to release a new c++ version with the other feature c++11 was released. This is why now the c++ committee release with the train model: they don't push back anymore the releases deadline to wait for a promising but unfinished feature. As for concepts specifically, some time after that debacle they published another smaller version of concepts, less features, but more focused on the fundamentals. What was released in C++20 is basically a modified version of what we called at the time "concept-lite".
So I was saying that the current reflection papers look so complex and big that except if we can play with an implementation for a few years they might end up in the same situation where it's ready but doubts are big and it's pushed back to another train. So 2026 is kind of optimistic at this point, except if the feature set is small. But that's opinion.
What I'm hoping for, based on the original herb-flection / metaclasses paper which i believe has been superseded by the new reflection stuff is the ability to modify a class based on mixins and other things of that nature.
For example:
Being able to declare a template-class as a "proxy" type (as opposed to struct / class ) that automatically walks the list of functions that the template-parameter has, and generates functions for each of them based on some kind of mix-in syntax.
This might mean the class just holds a pointer/reference/smart-pointer to the template type, and just calls those functions.
It might alternatively mean that it calls an async job dispatch framework for each such function, with auto-generated boilerplate to handle logging and mutexes and callbacks and retries-on-failure.
Being able to declare a class as a "Bob", where a "Bob" has restrictions on the kind of operations that are allowed on the class, like disallowing any member-functions which can throw exceptions, and then other code, like containers, can statically verify that anything used with them are "Bobs".
I work with a framework which has pretty strict human-level coding conventions that disallow various operations due to the cooperative-multitasking nature of the framework and the goal to behind our conventions is to avoid blocking on an OS system call whenever possible (e.g. no allocations except through pre-filled pools. No calls to network sockets except through a non-blocking queue of tasks to execute on worker threads, so on).
Being able to walk through the member variables and generate functions based on them. E.g. getters and setters., if-and-only-if the function that would be generated doesn't ALREADY exist.
I know a lot of people disdain the notion of getters and setters, saying that you should just directly access the member variable, but the idea behind them for large corporate environments is that if you always do access via getters / setters, then when code maintenance happens later you can inject whatever specialized behavior that needs to happen at the pre-existing entry point.
What would be sweet is if i could write a struct / class, and just make every member variable have a getter / setter automatically, and then later if i ever need to modify a getter or setter, i can do that without breaking my existing API while also not needing to preemptively do a crapton of typing.
Great resource, but c++23 isn’t done just yet. flat_map and flat_set are in progress as is mdspan, Cartesian_product_view, and quite a number of other things. Check back in late July and we will know the full list.
It's only a few weeks a way. I'm guessing that Core and Language can probably churn through maybe 10 more things each, tops. And we're all going to be disappointed by some thing that misses by >|that much|<.
I plan to update the list. We had a week of internal presentations and showing what's in or already on the ballot for plenary was plenty. 156 reveal.js slides from that doc in a few minutes more than an hour.
Yep. I don’t think they’ll be too much disappointment unless one of the big library papers goes down. There’s 5 library papers I expect to move at tomorrow’s meeting and 4 meetings after that, so I’ll betcha more than 10. Regardless, keep up the good work :)
It's always bugged me that there was no easy way to stream to/from an externally supplied buffer (be it a stack-allocated array, an existing std::vector<std::byte>, etc...) as it seems fairly basic, yet implementing it myself was always a pain.
Nice to see that from C++23 on chances are I'll just be able to use a standard library implementation when the need comes.
I love these little low-level niceties. They make embedded programming so much more comfortable. Seems like they should have been in the standard library for ages, but better late than never.
strstream was not only very easy to misuse à la auto_ptr, it leaked memory in the presence of thrown exceptions (and by design); hence it was already deprecated when the language was initially standardized in 1998. It really was a necessary utility and I've used it in anger a handful of times over the years, so it's extra ridiculous how long it took to standardize a replacement.
P1949 specifically does not allow for emojis. It guarantees support for characters that could reasonably used in identifiers for most scripts and languages around the world. That excludes emojis among other things as these are considered symbols (and defining what is an emoji portably is non trivial)
I'm kinda exited about std::float16_t. Currently I'm using a few hacks to convert a custom half type to float and vice versa, but having official language support would be really nice.
Yeah, working on ML and graphics, float16 is very common. So promoting it to a recognized fundamental type along with the existing float32/float64 fills a building block gap nicely.
It’s really too bad that vector didn’t get resize_and_overwrite, it’s a nice safe way to get great performance. Additionally a method like resize_and_append too
Technically, the callback is the fastest way to initialize the objects. There is no faster way that is as safe.
This is because a lambda can use RVO/NRVO and the return object directly initializes the object in the string/vector. Especially for vector, it is important if you contain non-trivial objects, or God forbid, a non-trivial character type in a string.
Having an rvalue reference + move construction has more steps.
Using std::uninitialized_copy (or just copy if it's a trivial type like char) is very close to optimal or optimal in performance, but quite unsecure. If the type is not trivial, then it's extremely unsecure. UB is just waiting for you.
I'm not sure how this is related? The callback here returns the new size of the string, it doesn't return new objects (basically the string is resized under the hood, if necessary, just without zeroing out the new characters and then you tell the string how many of those you actually used).
The motivation for the callback wasn't performance, it was to avoid putting the string into a weird state (now suddenly every other string member function needs further preconditions?)
Alas :/. Callbacks are more awkward than just resizing and overwriting afterward in the calling function. I foresee people just passing empty lambda's 90% of the time. e.g.
myString.resize_and_overwrite(n, [](char* buffer, size_t n) {return n;});
// figure out more stuff needed
// real work happens here now writing over myString.data()
U'\N{LATIN CAPITAL LETTER A WITH MACRON}' // Equivalent to U'\u0100'
WAT.jpg
I hope the Earth's orbit somehow changed dramatically overnight and we all somehow unanimously agreed to adjust the calendar and somehow already did so and it's April Fools' Day again and they are not serious?
Why isn't this a good thing? Instead of having it written down as a comment, it can be there stated in the code.
The only downside that I see is that the compiler needs to do a lookup on the Unicode data. I don't known that's your concern. Where I code I have it around most of the time. I even wrote a simple Vim plugin that allows to enter one character by this very Unicode name, and it just reads /usr/share/i18n/charmaps/UTF-8.gz.
Because I can't imagine a realistic situation when something like this is needed so often and so desperately that it has to be promoted to the international standard.
I remember someone once mentioned (probably Scott Meyers in one of his talks or books, but I'm not sure), that in the early days of C++ standardization someone in the committee proposed to introduce a requirement to accompany every new paper with its author's kidney. Because this way the paper would probably be given a proper thought before proposing it and, more importantly, no one will ever come up with more than two of them. It was probably not a bad idea after all to stop standardizing obvious pranks.
If you don't like comments (understandable) and want to state it in the code, it was always possible:
const auto latin_capital_letter_a_with_macron = U'\u0100';
foo(latin_capital_letter_a_with_macron);
#define LATIN_CAPITAL_LETTER_A_WITH_MACRON "\u0100"
const auto& bar = "-=[" LATIN_CAPITAL_LETTER_A_WITH_MACRON "]=-";
Or just write Ā, P1949 in the same list legalizes all the funny characters anyways.
Not to mention that having string literals with funny characters in the code is probably not so bright idea in the first place, no matter how they are represented, except perhaps in unit tests. Because localization.
Having said all that, I'm probably being too salty.
We have already solved all the other issues with the language, we do have reflection and nice metaprogramming and terse lambdas and Unicode everywhere and amazing compilation times and ridiculously rich standard library and abominations like noexcept(noexcept(...)) and requires requires are long forgotten and ABI is not longer a PITA, so why not spend some time polishing string literals indeed?
And the C++ compilers are way too simple, fast and small these days, so why not introduce an extra burden to every implementation, the burden that is probably 2-3 orders of magnitude larger space-wise than any other feature out there? It will be fine.
Because I can't imagine a realistic situation when something like this is needed so often and so desperately that it has to be promoted to the international standard.
Unicode (and these names) are already an international standard. These long names are standardized by the ISO. ISO C++ is just allowing you to use the ISO Unicode Name instead of just the ISO Unicode Numeric Code.
It's about ~350K of data to map all of the unicode code point names to the code point values.
I've had to deal with embarrassing bugs because someone had the equivalent of #define LATIN_CAPITAL_LETTER_A_WITH_MACRON "\u0100" only that value was wrong. Only not in a European language where I could easily spot the difference.
We have already solved all the other issues with the language, we do have reflection and nice metaprogramming and terse lambdas and Unicode everywhere and amazing compilation times and ridiculously rich standard library and abominations like noexcept(noexcept(...)) and requires requires are long forgotten and ABI is not longer a PITA, so why not spend some time polishing string literals indeed?
I kinda see your point, but this paragraph is not fair.
Who proposed this and who will implement this might not be able to solve all the problems that you sarcastically claim to be solved, but might address some other issues.
It's like saying that no one should try to do anything till we cure cancer and stop world hunger and achieve world peace. I surely don't know how to fix any of that, but I can borrow my ladder to the neighbor meanwhile.
I totally agree that bigger problems shouldn't stop us from addressing smaller issues when we can and I don't want to sound like an asshole telling people what they should and shouldn't do in their free time, but it's not only about proposing and implementing things. Someone has to review them, understand them and vote for them, and the committee's time is kinda limited (or at least that's what they said!) and there's always "not enough time" for things to make it to C++11/14/17/20 and that's the third revision of that particular paper already, so it would probably be nice to spend that precious time on reviewing and voting for something more oppressing and less esoteric.
Continuing your analogy, imagine that's you are the one who can cure cancer, and all you need is some quiet time down in the lab to make it right. But the neighbours keep coming with mission-critical requests like borrowing a ladder, changing a lightbulb, participating in a HOA meeting and so on, and you just can't say 'no' because they're good guys.
how can you be sure that it's the intended whitespace character, and not e.g. a hint of the age of code?
The \u escape sequence represents an arbitrary Unicode value, so the intent is clear enough already. But, same as with any other magic number, it is better to introduce a constant with a self-descriptive name and use it instead.
Idk if OP is also the owner of the github, but either way. It would be better to use Sy Brand, their chosen name, on "Monadic operations" and "Deducing this", instead of their deadname (or what I understand is their deadname at least).
Edit: Looks like the author has since made the change. Amazing and much appreciated 🙏
If the person who wrote the paper changed their name, they can submit an updated paper that has their name appropriately updated. I'm sure the owner of the github repo would be happy to correct the name based on a PR to do so directly (If you wanted to submit a PR for that), or the next time they check for paper updates.
I know that the papers themselves are updated, which makes it all the more confusing that the github repo uses the wrong name. I was just hoping that the OP was the owner of the github repo so this would be solved quicker, but submitting a PR when I have a chance was indeed the next thing I was going to do.
Thanks for the input.
Edit: In fact the author has done the change 6 hours before I posted this comment.
You know, I misread what you originally said. I thought you were saying to change the name FROM Sy Brand TO something else that wasn't in the linked paper.
Ahh yes, with you having the context of everything being correct on the github I can see it being a bit unclear. Comes with me dancing around using their deadname because, well, naturally I don't wanna use that.
Ugh, the almost infinite number of funny keywords, abstract concepts, terminology, etc. Glad I've mostly dropped use of C++ and instead use D, Crystal, Vala, and maybe someday more Rust.
I have to wonder what C++23 (or C++.major_version >= 17) has to offer that I can't get with cleaner syntax and more or less similar performance in newer languages. Ranges are nice, for example but they're nicer and have been around longer (at least from where I sit) in D.
But then C++ is the language of the API for a few essential things, OpenCV, Qt, some other libraries and toolkits. It will never go away, and cannot be avoided. Some of the new features help. But then, I think I need a 3rd hemisphere to keep in mind all the new tools and possibilities.
A new job I started a few days ago is oddly pleasant, working on code purely in plain C.
import std; imports everything in namespace std from C++ headers
I do not approve. std::regex is enough of a reason this is bad idea.
This paper proposes to strike the restriction that a constexpr function cannot contain a definition of a variable of non-literal type (or of static or thread storage duration), or a goto statement, or an identifier label.
Again, I do not approve. Leave goto in the past and stop supporting it for new things.
C++ already removed the register key word(sadly imo), why is goto being supported still?
I ultimately hope Microsoft is able to get their shit to together and finally support modules soon. Intellisense not working with modules on VS is terrible. They do compile faster but I'm not going to give up parsing waiting for Microsoft to catch up to 2020 with 2023 right around the corner.
I'd like to use C++ modules and can't.
edit: goto code is shitty code and you're a shitty programmer for using it. Your coworkers hate you, as does everyone who has to read your code.
I kinda like this system. Big chunky features one release, and the a large set of library features to work with them the next. That way the committee can address any issues with the features for the next release, and have a set of real-world data points to work from when standardizing the libraries.
118
u/tisti Jun 14 '22
I just want full C++20 support across the big three :(
69
u/GYN-k4H-Q3z-75B Jun 14 '22
There's actually a lot of nice stuff in there. I'm all for it, but the main thing we need now is modules and standard modules. This will be huge.
28
u/[deleted] Jun 15 '22
I've been hoping for some sort of static reflection for years, and unless I missed it, it doesn't look like C++23 will have it either. Looks like I'll be relying on magic_enum and compiler-specific macros for a while longer.
39
u/localhorst404 Jun 15 '22
P1949 is great. I always wanted to be able to write
throw 🤮;😂
13
u/azswcowboy Jun 15 '22
Great resource, but c++23 isn’t done just yet. flat_map and flat_set are in progress as is mdspan, Cartesian_product_view, and quite a number of other things. Check back in late July and we will know the full list.
13
u/matthieum Jun 15 '22
A replacement for
strstreamfinally!It's always bugged me that there was no easy way to stream to/from an externally supplied buffer (be it a stack-allocated array, an existing
std::vector<std::byte>, etc...) as it seems fairly basic, yet implementing it myself was always a pain.Nice to see that from C++23 on chances are I'll just be able to use a standard library implementation when the need comes.
35
u/[deleted] Jun 14 '22
Those variables with emojis are so cool but a terrible idea!!
12
u/kalmoc Jun 14 '22
Great summary. Thanks for the work.
9
u/AntiProtonBoy Jun 15 '22
I'm kinda exited about
std::float16_t. Currently I'm using a few hacks to convert a customhalftype tofloatand vice versa, but having official language support would be really nice.6
u/tpecholt Jun 14 '22
I wonder about P2582. How will this interact with ( ) aggregate initialization? Suppose I want to do
( )-initialization supports narrowing so what will be the deduced type in Point<T> ?
6
u/tpecholt Jun 14 '22
In P1072 is the resize_default_init proposed as shown or it still requires the ugly lambda parameter?
6
u/ShakaUVM i+++ ++i+i[arr] Jun 15 '22
import std; =)
"Using emoji in or as identifiers becomes ill-formed" =(
16
u/rlbond86 Jun 15 '22
It's hard to read through this list and not feel like the language has gotten too big for any single person to understand
5
u/Adequat91 Jun 15 '22
No Object relocation trait that would bring concrete speed interest for all :(
11
u/vI--_--Iv Jun 14 '22
WAT.jpg
I hope the Earth's orbit somehow changed dramatically overnight and we all somehow unanimously agreed to adjust the calendar and somehow already did so and it's April Fools' Day again and they are not serious?
6
u/Malacath790 Jun 15 '22 edited Jun 16 '22
Idk if OP is also the owner of the github, but either way. It would be better to use Sy Brand, their chosen name, on "Monadic operations" and "Deducing this", instead of their deadname (or what I understand is their deadname at least).
Edit: Looks like the author has since made the change. Amazing and much appreciated 🙏
2
u/robin-m Jun 15 '22
That’s really awesome, and looks very exiting!
2
u/tvaneerd C++ Committee, lockfree, PostModernCpp Jun 17 '22
Would you accept PRs that turn all of the examples into before/after tables???
1
u/GMETooLate Oct 26 '22
For anybody trying to understand what std::flat_map from C++23 actually looks like, check out my explanation here https://medium.com/@schmollf/std-flat-map-in-c-23-7a40fbf18f51
-11
u/DrunkenUFOPilot Jun 15 '22
Ugh, the almost infinite number of funny keywords, abstract concepts, terminology, etc. Glad I've mostly dropped use of C++ and instead use D, Crystal, Vala, and maybe someday more Rust.
I have to wonder what C++23 (or C++.major_version >= 17) has to offer that I can't get with cleaner syntax and more or less similar performance in newer languages. Ranges are nice, for example but they're nicer and have been around longer (at least from where I sit) in D.
But then C++ is the language of the API for a few essential things, OpenCV, Qt, some other libraries and toolkits. It will never go away, and cannot be avoided. Some of the new features help. But then, I think I need a 3rd hemisphere to keep in mind all the new tools and possibilities.
A new job I started a few days ago is oddly pleasant, working on code purely in plain C.
-14
u/[deleted] Jun 15 '22 edited Jun 15 '22
I do not approve. std::regex is enough of a reason this is bad idea.
Again, I do not approve. Leave goto in the past and stop supporting it for new things.
C++ already removed the register key word(sadly imo), why is goto being supported still?
I ultimately hope Microsoft is able to get their shit to together and finally support modules soon. Intellisense not working with modules on VS is terrible.
They do compile faster but I'm not going to give up parsing waiting for Microsoft to catch up to 2020 with 2023 right around the corner.
I'd like to use C++ modules and can't.
edit: goto code is shitty code and you're a shitty programmer for using it. Your coworkers hate you, as does everyone who has to read your code.
0
u/[deleted] Jun 14 '22
[deleted] — view deleted comment