3 ms·
It's interesting that you mention a "C with classes" as the worst of both worlds. There's a large group of people that are perfectly happy with C, and there's a
by jbermudes 15y ago
It's interesting that you mention a "C with classes" as the worst of both worlds. There's a large group of people that are perfectly happy with C, and there's a large group of people that like the OOP that C++ offers, but there's a lot of areas of C++ that many people actively avoid or dread, leading to the old joke that everyone programs in their own subset of C++.
It seems that with that in mind, coupled with the recent surge of people working on systems languages (Go, Rust, D) that people are looking for a something else. It'd be neat if we could resurrect Stroustrup's orginal prototype of C++ that was literally "C with classes". I wonder whatever happened to that...
- cageface 15y agoThe most interesting part of C++ isn't the OO stuff, IMO, it's the generics. Modern C++ libraries aren't particularly OO but rely a lot on templates. I'd much rather see somebody take a crack at a new systems language that put generic programming front & center in a cleaner context.
- quantumhobbit 15y agoI always felt like templates were a kludge. Clearly the libraries make great use of them, but I've never been able to implement them in a way that doesn't screw up the build process. Probably because I never learned them the right way. That would be the tutorial I'd like to read: "Learn C++ templates as though they aren't voodoo."
- angelortega 15y agoI agree absolutely: templates are only just a little less crappy than preprocessor magic. I personally never use them.
- exDM69 15y agoYou're very wrong. C++ templates are very capable of expressing very powerful idioms. C++11 adds this to this power with variadic templates. std::function, std::tuple, etc are the future. Please do not be offended, but if that is your attitude towards a major language feature of C++, you probably should not be writing tutorials about it.
- AshleysBrain 15y agoI disagree, templates in C++ are great! Just make sure you declare all the code (both declarations and definitions) in a header file, and it should work fine.
- quantumhobbit 15y agoHaving to put both declarations and definitions in the same header file is what feels kludgey to me. It is a break with the normal way of doing things.
- cageface 15y agoIn C++11 you can split the declaration and implementation with the new external template feature.
- cageface 15y agoThe ideas behind templates are brilliant but, yes, as implemented in an already big & complex language they seem like a kludge. But if you designed a low-level systems language from scratch with clean generics as a top priority I think you could come up with something pretty interesting and a lot simpler than the OO mismash you tend to get with C++. Think of something like OCaml but with a less intrusive runtime, for instance. C++ got a lot more functional with C++11 but there's too much baggage for the simpler statically polymorphic language inside C++ to emerge cleanly.