When I wrote the article I had C# and Java in mind, but I write a lot of C++ so I'll comment about C++
When the compiler has total visibility of an abstract virtual class as well as its implementations, it is, to the contrary, able to optimize through a process of "devirtualization".
I personally like to do a unity build with gcc using -O2 for optimizations, I haven't really bothered with LTO. Many people don't do either, but that's what I had in mind when I said virtual functions aren't inlined. When a function is large enough I'm not sure if lto is enough to get it inlined.
LTO is a very standard
I don't disagree
++, if you want to guarantee that your interfaces are compile-time polymorphic, the correct pattern is CRTP example
I rather not have so many templates. I know they're somewhat fast when there's little to no code inside the template but it seems like this would put a lot of code in headers and make things SLOW
Right now my C++ project compiles in 7 seconds and incremental builds are <2, often <1sec. I mostly can do it because a lot of the time I touch files that only include project headers and my standard lib. This is with UB sanitizer on too.
Really, I don't think there's reasons to use an interface except the two cases I mentioned (creating a tree from data, having an IO interface in a standard lib). No need for CRTP
if you want to post some controversial things, saying "something else which is too long for a comment" is somewhat disingenuous
My standard lib has nothing to do with anything in the article
You have this "solution" to iterators, but you hide them behind disinterest
No, it's really just using a slice (or C++ 'span') with the type you want. Only directory iterators are different which is in my wip async lib. The problem I've been thinking about is how to make it usable and efficient (at least having little bookkeeping). There's no promises, locks, and I'm a little worried I'll end up causing pain with how everything is a callback. I don't think a large switch table is the right move. But anyway, this isn't related to the article either. No interfaces in my async lib either.
Interfaces are frequently used in the standard library. One of the problems that a std::span (the C++ name for slice), cannot encapsulate is iteration over non-contiguous memory
Yep, I hit that problem too. In one case I used a span<span<T>>. In another I called myobj.get() which gave me a span, and if it was zero length it was over. Yes, it's an extra loop but it also let the optimizer unroll the inner loop if it wanted to. Another benefit is instead of calling next() every time I call it once per chunk
power of concepts
I like the requires statement, I use it all the time. My lib only supports C++20 and higher
If you are so certain, can you prove it?
I seen it at a few workplaces, and I also don't really care about other peoples programming opinions. It was meant to be a short post, not a research paper. I don't think anyone even cares about a thing I said in the article except maybe you
I'm not sure what your language of choice is, since it doesn't feel like it's C++
I like C# and C++. Oddly enough I hate all system languages except for C++ (including C, unless its small and a lib). I also think C++ is bad but it's still my favorite
I wonder if you'll like any of my other articles. They're on the homepage
I also don't really care about other people's programming opinions
Okay then! Conversation over, I guess! Why would I pour so much time and effort if you're not going to care? You're a jerk but here really I'm the idiot.
Are you new to reddit? Have you seen what people say here? Even in person I seen some silly suggestions that more than a handful of people believe. I have to know the person first before I take anything they say seriously.
I did reply to you, and I think everything I said was clear besides the above? IDK if you think I'm 'wrong' because I disagreed with some of the things you said
View all comments
Show parent comment
-1
u/levodelellis Oct 13 '26
When I wrote the article I had C# and Java in mind, but I write a lot of C++ so I'll comment about C++
I personally like to do a unity build with gcc using -O2 for optimizations, I haven't really bothered with LTO. Many people don't do either, but that's what I had in mind when I said virtual functions aren't inlined. When a function is large enough I'm not sure if lto is enough to get it inlined.
I don't disagree
I rather not have so many templates. I know they're somewhat fast when there's little to no code inside the template but it seems like this would put a lot of code in headers and make things SLOW
Right now my C++ project compiles in 7 seconds and incremental builds are <2, often <1sec. I mostly can do it because a lot of the time I touch files that only include project headers and my standard lib. This is with UB sanitizer on too.
Really, I don't think there's reasons to use an interface except the two cases I mentioned (creating a tree from data, having an IO interface in a standard lib). No need for CRTP
My standard lib has nothing to do with anything in the article
No, it's really just using a slice (or C++ 'span') with the type you want. Only directory iterators are different which is in my wip async lib. The problem I've been thinking about is how to make it usable and efficient (at least having little bookkeeping). There's no promises, locks, and I'm a little worried I'll end up causing pain with how everything is a callback. I don't think a large switch table is the right move. But anyway, this isn't related to the article either. No interfaces in my async lib either.
Yep, I hit that problem too. In one case I used a
span<span<T>>. In another I called myobj.get() which gave me a span, and if it was zero length it was over. Yes, it's an extra loop but it also let the optimizer unroll the inner loop if it wanted to. Another benefit is instead of calling next() every time I call it once per chunkI like the
requiresstatement, I use it all the time. My lib only supports C++20 and higherI seen it at a few workplaces, and I also don't really care about other peoples programming opinions. It was meant to be a short post, not a research paper. I don't think anyone even cares about a thing I said in the article except maybe you
I like C# and C++. Oddly enough I hate all system languages except for C++ (including C, unless its small and a lib). I also think C++ is bad but it's still my favorite
I wonder if you'll like any of my other articles. They're on the homepage