Discussion on static reflection syntax in C++

Dukc ajieskola at gmail.com
Mon Feb 22 21:47:48 UTC 2021


On Monday, 22 February 2021 at 21:16:07 UTC, H. S. Teoh wrote:
> That would perhaps put more pressure on C++ devs to switch to a 
> saner language! ;-)

But who would maintain the C++ programs then? There may be a 
reasonable case to discourage new projects in C++, but's that's 
hardly the same as trying to kill C++ programming.

Until we can automatically transpile everything I quess.


> Years ago, I worked in a team project where there was a 
> C++-based infrastructure so fancy and over-engineered, that 
> after a while nobody knew how to use it properly and started 
> spending more time working around it than using it.  
> Eventually, we ditched the C++ portion completely and rewrote 
> it from scratch in C.  It was a refreshing change.  C's 
> relative dearth of features was certainly limiting, but 
> limitation is not a bad thing in a team where people are 
> constantly coming and going. No matter how horribly the code 
> devolved, there was still only a small set of features it could 
> abuse, and the scope of abuse is well-known and manageable.  It 
> wasn't *enjoyable* to go back to C per se (D takes the cake on 
> that one :-D), but it was definitely better than drowning in 
> the ocean of badly-interacting misfeatures that is C++.

Hmm, I see. The engineer in me says it's foolish to ditch all 
C++, keep the function overloading and simple templates at least 
(I'm thinking something like `T binaryFun<T>(T arg1, T arg2)`). 
But I can kinda see that rules like that might have weaker 
authority than a simple language change. I'm still suspicious 
about the tradeoff you made but at least I see potential reason 
to accept it.

>
>
>> But I too kind of fail to see how `f(...[:tuple:]..., a, b)` 
>> would cut it
>> when `tuple.expand.f(a,b)` has been possible in "another 
>> language" for like
>> 10 years.
>
> That's why C++'s early death would do everyone some good. Maybe 
> some of the survivors would discover D. :-D

I meant that I don't see how it would cut to add as a new 
language feature. But for the hapless programmer who is down to 
either it, the C preprocessor, or copypasta, it just might make 
sense IMO. Just barely, and just maybe.




More information about the Digitalmars-d mailing list