I'm thinking golang style OOP - basically structs with syntactic sugar of dot-calling. Nothing more. We wouldn't want full blown vtable C++ style inheritance with polymorphism, operator overloading etc. because this would create another C++ (D++ maybe? ;)
However while we're looking at any library, GTK for example, those structs are made like that. But you're right - this only looks simple, as there are many pitfalls we could hit when implementing it.
Personally - I think C just needs to remain as C. Sure there will be improvements along the way... but whenever I use C, I stick with C99.
There are many alternatives or newer languages which I think is the answer to your proposal.
You mentioned Go, which is absolutely reasonable.
However, like all languages, Go has its pros and cons as well. I am sure someone has tried to push for a new feature that may be OOP-like and it gets rejected. You can say that for any language.
We also have Rust, Odin, Zig, C3, etc -- all have their own sprinkles and flavours on how to do things. These are "better C" or "better C++" depending on how you view it.
Personally I prefer Odin. It (kinda) has namespaces but there are no classes... and functions/procedures are still created outside the struct. To me, out of the many languages, Odin keeps it C but with many improvements and I am happy with that.
Comments
I'm thinking golang style OOP - basically structs with syntactic sugar of dot-calling. Nothing more. We wouldn't want full blown vtable C++ style inheritance with polymorphism, operator overloading etc. because this would create another C++ (D++ maybe? ;)
However while we're looking at any library, GTK for example, those structs are made like that. But you're right - this only looks simple, as there are many pitfalls we could hit when implementing it.
Personally - I think C just needs to remain as C. Sure there will be improvements along the way... but whenever I use C, I stick with C99.
There are many alternatives or newer languages which I think is the answer to your proposal.
You mentioned Go, which is absolutely reasonable.
However, like all languages, Go has its pros and cons as well. I am sure someone has tried to push for a new feature that may be OOP-like and it gets rejected. You can say that for any language.
We also have Rust, Odin, Zig, C3, etc -- all have their own sprinkles and flavours on how to do things. These are "better C" or "better C++" depending on how you view it.
Personally I prefer Odin. It (kinda) has namespaces but there are no classes... and functions/procedures are still created outside the struct. To me, out of the many languages, Odin keeps it C but with many improvements and I am happy with that.
Each to their own.