u/marler8997in r/Zig • Recommends
#constexpr#metaprogramming#templates
CppCon 2019: David Stone - Removing Metaprogramming From C++, Part 1 of N: constexpr Function Params
189K subscribers • 103 videos on Hallway • Conference channel
- Recommended by 2 people: 2 in engineering communities.
- Presented by David Stone
- Linked in the descriptionCppCon/CppCon2019davidstone/isocpp
Advanced. Deep dive for people who know the field.
15K views7 years ago2 recommendations
Programming languagesC++Language design and type systems
David Stone proposes adding constexpr function parameters to C++ to merge compile-time and run-time programming and simplify code.
CppCon.org — Discussion & Comments: reddit.com/r/cpp/ — Presentation Slides, PDFs, Source Code and other presenter materials are available at: github.com/CppCon/CppCon2019 — C++ has, buried within it, no less than four "general-purpose" programming languages. We have regular run-time C++, constexpr, templates, and macros. This presentation will cover a new proposal for C++: constexpr Function Parameters. It aims to make C++ a much more powerful language by helping to merge constexpr programming into regular C++. This will allow writing code that is faster, is easier and more natural to use, is terser, and catches errors at compile time. This new language feature would provide a way to annotate a function parameter as constexpr, letting you do things like overload on whether something is a compile-time constant, or pass constants to things that cannot have template parameters (like constructors and operators). This presentation will focus on the principles used in the design of C++ and in this feature. From those principles, we will go into the details of the proposal. This presentation will briefly cover what constexpr is used for as of C++20 (the version of C++ that is being finalized now and will be officially 'released' in 2020). The proposal for constexpr function parameters is targeted at C++23 ('released' in 2023). The presentation will briefly cover the standardization process and timeline. Recommended background (none of these are necessary, but they are helpful): * No Shadow Worlds: probablydance.com/2015/02/16/ideas-for-a-programming-languag… * Inventing on Principle: vimeo.com/36579366 * constexpr: Introduction (as of C++11 and C++14) youtube.com/watch?v=fZjYCQ8dzTc The proposal paper can be found at github.com/davidstone/isocpp/blob/master/constexpr-parameter… — David Stone Uber Software Engineer Boulder, CO David Stone works on autonomous vehicles at Uber in Louisville, Colorado. He is a member of the C++ standardization committee, where he chairs the Modules Study Group (SG2) and is the vice chair of the Evolution Working Group. He has written an algorithm that solved the traveling salesman problem in constant time. He can square the circle and divide by zero. He can move his king into check. He once wrote an optimizing compiler that solved the halting problem, but doesn't need to use it because his code is already optimized.) — Videos Filmed & Edited by Bash Films: BashFilms.com Work at Hudson River Trading (HRT): tinyurl.com/safxfctfWhy it's here
2 people recommend thisWhat people say. Recommended by Zig developers as an interesting parallel to Zig's comptime parameters, showing how C++ is trying to solve similar metaprogramming problems.
u/stuffsnoutin r/Zig • Recommends
u/marler8997in r/Zig • Mentions
On “hey how different is Zig comptime from C++ constexpr/consteval?”
u/marler8997in r/Zig • Mentions
On “Zig-style generics are not well-suited for most languages”