News for hackers. Stuff that matters.
Re:Common Misconceptions about Compilers by Animats on Tuesday December 10, 2024 @01:27AM (#42374324)
About C/C++ compilers, mostly.

C++ has terrible template and include compilation problems, for historical reasons.

Re:Common Misconceptions about Compilers by baziotis on Tuesday December 10, 2024 @01:55AM (#42374466)
Yes, but... First, it is what it is. Second, it's not that C++ people made bad decisions in the 80s but the decisions were great afterwards. Let's take C++ metaprogramming in general, which templates are part of. Let's take if constexpr (or static if) as an example, which C++ took straight from Dlang. It is useful for introspection which is almost indispensable for metaprogramming.

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.

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.
Re:Common Misconceptions about Compilers by pjmlp on Tuesday December 10, 2024 @05:42AM (#42375608)
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.
Re:Common Misconceptions about Compilers by pjmlp on Tuesday December 10, 2024 @09:14AM (#42376993)
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.
Re:Common Misconceptions about Compilers by pjmlp on Tuesday December 10, 2024 @05:40AM (#42375592)
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.