19 ms·
Survey results: ISO C++ feature proposals
- ebg13 7y agoWhat monsters put compile-time programming over concurrency and pattern matching?
- lgeorget 7y agoBut what if you can do pattern-matching at compile-time?!
- yk 7y ago#define stupidHack true
- steveklabnik 7y ago'inspect constexpr' is part of the pattern matching paper, IIRC.
- majidazimi 7y agoIt means concurrency and pattern matching is not really critical for the community as it is for other language communities. There is no insult, but generally speaking an average C++ developer has deeper knowledge than an average Java developer which essentially means C++ developer is somewhat comfortable with traditional concurrency toolkit like threads.
- asveikau 7y ago> C++ developer is somewhat comfortable with traditional concurrency toolkit like threads. As somebody who has used threads a lot and written code in kernel mode etc. something about this scratches me the wrong way. The traditional concurrency toolkit has some issues. Being experienced with them can make you somewhat jaded against them. In particular, the standard way to solve problems in that mode of thinking is to introduce locks, and experienced people know all the problems that locks have, and that the "solution" is harmful in the extreme. So it is acceptable for such a programmer to want more options, standardized. I would even argue that this is more important than introducing std::mutex, std::thread, or std::atomic, because you can say that in the pre-C++11 era nonportable interfaces like pthreads or win32 were already working OK for people that chose to use them.
- jcelerier 7y ago> In particular, the standard way to solve problems in that mode of thinking is to introduce locks nowadays I mostly see lock-free queues and message passing across threads, it's trivial to do with a few nice libraries
- stefan_ 7y agoThe C++ committee has been captured by a hostile force that tries to turn every C++ compiler into the slowest imaginable C++ abstract machine emulator.
- banachtarski 7y agoWhy would we want concurrency if we already have thread support and coroutines. Concurrency is a nice-to-have abstraction that is not without overhead and design tradeoffs.
- alexhutcheson 7y agoLibrary authors and maintainers.
- ludamad 7y agoI feel like Herb Sutter has always written favourably about compile time tricks, and it's reflected in his audience
- jandrewrogers 7y agoIt actually makes sense to me. Compile-time programming is a very powerful feature of C++ that does not have an equivalent in other systems languages. It is commonly used to effect several types of compile-time verification of code design and safety that would be difficult to do any other way, in addition to its more obvious use case for effecting relatively complex performance optimization algorithmically. The ability to algorithmically generate almost arbitrarily complex types during compilation that are fit to purpose is an extremely useful feature for fast, high-reliability code and used pervasively in modern C++ as the facility has become more expressive. Filling some of the last remaining holes in its expressiveness would be high-value novel capability. Think of it as a hardcore safety feature. You can put me in the camp that adding more support for concurrency in the language beyond a feature like coroutines (in C++20) and the existing primitives is not that useful. It would have the same issue as STL containers, where there simply isn't enough control of the implementation details for them to be used for many applications C++ is used for, so most concurrency infrastructure will be purpose-built anyway. Pattern matching functionality can already be effected in many cases, albeit quite ugly. This would be more syntactic sugar than new capability, so I can understand why it isn't prioritized as much.
- pjmlp 7y agoHave you ever used Common Lisp macros, D meta-programming, Nim, Dylan macros, BETA pattern matching, OCaml pptx templates, Template Haskell,...? Yes, C++ compile time capabilities are powerful, but they aren't by all means the only game in town.
- jandrewrogers 7y agoAlmost none of those are systems programming languages, which was the domain of comparison.
- pjmlp 7y agoCommon Lisp (Lisp Machines), D, Nim, OCaml (MirageOS Unikernel, Docker macOS TCP/IP stack), Haskell (House OS and Galois bare metal deployments).
- steveklabnik 7y agoAnother interesting thing about this survey is that the categories don't have equal representation; so for example, "pattern matching" has two papers, one of which is extremely popular, but "compile time programming" has thirteen papers, with a few of them being significantly more popular than the others (one has only one vote, for example, but another is, in my mind, one of the most exciting proposals coming down the line for C++). There's tons of reasons why this could be this way; and it shows why creating these kinds of things is just hard.
- paulirwin 7y agoIt also might be a result of the pattern matching proposal having only been introduced this year, and concurrency/coroutines having been a focus in C++20 already. Whereas compile-time programming has been discussed for a while now and is getting more well-baked, but still hasn't made it fully into the language yet and many (myself included) are eager to use it. See the revision history of P0707 for example.
- bla3 7y agoThere's a helpful disclaimer section that states "Bias: I posted the poll on my personal blog, which could bias results in favor of my proposals." Another bias all voluntary surveys are prone to is prone to that's not listed is https://www.quora.com/What-is-voluntary-response-sampling-What-are-some-examples https://www.quora.com/What-is-voluntary-response-sampling-Wh... So basically, don't use this data to make decisions :)
- TillE 7y agoI'm pleased that people seem to agree that compile-time reflection is a no brainer, even though it still won't be coming until C++23 at the earliest. I'm sick of the dumb preprocessor hacks required for something as simple as iterating through enum values with their string representations.
- ludamad 7y agoI would love that feature, and the ability to have a function that takes name + value pairs from a struct. However I suppose once you go down that rabbit hole, you may as well have all the features of annotating members and accessing that data too
- Razengan 7y agoIs there a petition for making C++ less ugly? There should be. It’s a Frankenstein’s monster made of parts from other Frankenstein’s monsters. If Lovecraft were alive today this would be his prime eldritch deity. An abomination of impossible geometries you could not make sense of even if your eyes could see in 4D.
- banachtarski 7y agoPattern matching is listed there, but I think the onus is on you to describe what you're talking about. I guarantee that any language (even the HN-beloved Rust and Go) can produce hideous code.
- Razengan 7y ago> the onus is on you to describe what you're talking about. I'll start with a simple example. I haven't worked with C++ in ages and I hope never to, but in the last C++ file I came across: Right at the beginning there were 3 different kinds of include/import statements. One with "" and another with <> and I don't remember what the third was but it had yet another format. Now, I know what they mean, or I can look it up, and there may be a valid need for the distinction, but it is ugly. Here's another confusion I was recently reading about: https://stackoverflow.com/questions/516237/when-should-i-use-typedef-in-c https://stackoverflow.com/questions/516237/when-should-i-use... I find Assembly and "pure" C a lot more elegant than this nightmarish atrocity.
- krisrm 7y agoIf there's a valid need for the distinction, and it's straightforward (<>s search system libs first vs quotes search CWD first IIRC), what would be less ugly? Keeping in mind the vast number of C++ files out there that have already baked this convention in :)
- Razengan 7y agoHow about using the CLI path resolving convention, where you implicitly look in the CWD first and then the environment path? Specify specific paths by something like "$SYSTEM\foo.h" or "$CWD\foo.h" Either would be more readable and less magic than <> or ""
- bestouff 7y ago"Type Safety" is only at position #12. I would have expected that nowadays C++ programmers would have been a little more aware of the perils of a not-strong-enough type system.
- banachtarski 7y agoWe're already getting concepts, not sure why it'd be voted again
- deleted 7y ago[deleted]
- otabdeveloper4 7y agoC++ is already type-safe enough. The problem isn't a lack of language support, the problem is that programmers view safety as "needless boilerplate" and go to great lengths to subvert the language on safety issues.
- jcelerier 7y agoso, what would you do to add more type safety to C++ ?
- adrianN 7y agoUsing libraries is such a pain in C++ compared to other languages that people choose worse libraries just because they come header-only. I don't understand why that is not a higher priority. Cargo is lightyears ahead of any C++ system.
- umvi 7y agoHonest question because I don't know how cargo works. How would a package management system for C++ work? Would there be a centralized repository containing shared objects, static objects, and header files of all the packages? Who would pay for the hosting? How would you track which libraries are compatible with which compilers/OSes/architectures? Seems like at this point it would be a herculean effort to create cpppm because of how fragmented the compilers/support is across systems. And so it would be a broken piece of garbage so people wouldn't use it.
- adrianN 7y agoA central repository is helpful but not strictly necessary. I just want to have a config file where I specify what version of a library I want and where the build system can fetch it and have that work recursively for dependencies.
- umvi 7y ago> the build system can fetch it and have that work recursively for dependencies Which build system? CMake? SCons? GNU Make? Unix Make? Autotools? Visual Studio Solution? Cpp libraries are far from having a standardized build system. And without a standardized build system, you can't do what you describe. I suppose you could say "CMake is the standard" and then only support CMake-compatible libraries, but again, that leaves hundreds of packages out of reach.
- s_tec 7y agoAnd why are these build systems necessary in the first place? They mostly exist to work around the lame library ecosystem, where you never know what's installed or where to find it. Solving the "library problem" would presumably render these tools and their horrible complexity obsolete. If there were some type of system where library A says it depends on library B (via a URL or some other non-centralized thing), and the compiler knows how to resolve this, then you don't need 90% of the features these tools provide. You still need build parallelization and maybe detection for non-standard compiler features, but this is a much smaller and simpler problem.
- favorited 7y agoHerb's error handling proposal is great. It's very similar to Swift's error handling – exception-like syntax, but with deterministic behavior. Glad to see it at #3 (with the caveat that it was obviously Herb's survey). http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/p0709r0.pdf http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/p070...
- anarazel 7y agoI unfortunately quite hate the direction of not being able to write conforming programs that handle out-of-memory in a way that's distinct from terminating. That's a great default for a large majority of systems, but e.g. for a database server it sucks. When the system is configured appropriately (which is not the default, and has its own sets of problems, in particular with fork()), postgres e.g. handles the vast majority of out-of-memory cases gracefully, by just failing the query that encountered the exhaustion. With this proposal, that's effectively impossible to do, without either being non-conforming ("with the additional restriction that any installed new_handler must terminate"), or not using any standard library code (which is proposed to not throw any exceptions: "For each standard function for which allocation is the only reportable error, make the function noex-cept"). It's practically impossible to use only explicitly checked allocations everywhere. One can do it for allocations that are more likely to fail (e.g. because they're large), but not for every small thing. In postgres, it's my experience that a very significant fraction of real-world allocation failures are on small allocations, not huge ones. Now postgres is currently C (but that's imo more historical baggage than anything, and has pretty significant costs), but this would effectively prevent us from taking advantage of a lot of C++ if we ever decided to move. FWIW, postgres OOM handling basically works by doing allocations via it's 'memory contexts', which check allocation failure (obviously only really possible if the OS signals them, requiring e.g. to explicitly change the overcommit settings on linux). Allocation failures are handled by switching to a memory context that sigsetjmp's to a higher level. That higher level then releases resources by bulk-releasing memory using the memory context mechanism, and handles other resources (locks, other resources) via the related resource owner mechanism. But that mechanism is - as far as I know - impossible to do in realistic confirming C++, because one cannot call all the relevant destructors.
- DiseasedBadger 7y agoI'm saddened to see runtime reflection up there, but heartened to see metaclasses. It's also a painful topic, considering how vastly outdated Qt's use of C++ is, and how many libraries are doing similar. Poor 'Copper Spice'!
- humanrebar 7y agoWhat's wrong with runtime reflection? Seems more flexible and generalizable than inventing hierarchies of metaclasses, some of which include reflection accessors.