back

by uecker·2y ago·view on hn ↗
Having switched from C++ to C, I think C is a lot less weird than C++. But I also observed that C++ programmers usually do not "get" C (but think they do, because "it is just a subset") and often think some parts are weird simply because they are different.

In any case, if you need a clean subset of C++ (but nobody I have met really agreed about what this is) nobody is stopping you from defining one.

1 comments
> Having switched from C++ to C, I think C is a lot less weird than C++.

Overall? Without a doubt. But these specific features they've been adding are implemented very unnecessarily strangely just to avoid fully committing to them, so that they end up in this design space where they may not be weirder than the full Lovecraftian horror of the equivalent C++ feature, but they are much weirder than the ideal/abstract concept of the equivalent C++ feature, which is what I wish they would have pulled in. Like, looking at this proposal, it isn't clear to me at all how the compiler is actually compiling or the runtime is executing these polymorphic function calls at all, in cases where they don't just collapse to void*. And it isn't clear to me how exactly type scoping and substitution works either. Whereas in concept at least templates are crystal clear and also easy to expand to do much more advanced macro-less metaprogramming, like D does.

> and often think some parts are weird simply because they are different.

I have way more experience with C than C++, but I'm usually a Rust programmer which works more like C++ so maybe that's where my bias is, but I really think this implementation is unnecessarily weird in general too — I've used a lot of languages.

It seems some things are crystal clear to you because you are already used to them, but here you do not "see" how this will work, so you have your doubts. Fair enough.

To me it is crystal clear how this will work, and I much prefer this to generics in C++ and Rust or other similar languages.

But I am not saying it is wrong what C++ and Rust does. So if you prefer this, those languages are there ready to be used. I just think there should also be a good alternative for people who do not like how this works there.