Re:Common Misconceptions about Compilers
by gpderetta on Tuesday December 10, 2024 @05:12AM
(#42375446)
If constexpr and static if have different semantics, specifically if constexpr can't inject names outside it's scope which is what Bjarne was worried about.
While true, if reflection actually lands, it will bring symbol injection with it.
Re:Common Misconceptions about Compilers
by gpderetta on Tuesday December 10, 2024 @08:29AM
(#42376617)
I think the injection will still properly respects scoping.
Might be, so far I only watched the few talks that touched upon reflection ideas and upcoming roadmap, some stuff might even only land on C++29, assuming reflection MVP does indeed land on C++26.
Kudos for pointing out D compilers capabilities, I feel it is quite often left out in similar postings.
Using import std in VC++ gives me some hopes this will improve, however given the current mess of C++ compilers catching up to recent ISO C++ revisions, we are several years away from this to matter in portable code.
Walter Bright and Andrei Alexandrescu introduced static if in Dlang early and around 2012, they co-authored a static if proposal for C++ (https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2012/n33...). Bjarne Stroustrup, in his infinite wisdom, co-authored a rebuttal that rejected it, only to realize long overdue that it's an incredibly useful feature and introduce it in C++17.