A Summary of the Metaclasses Proposal for C++
fluentcpp.com
fluentcpp.com
On the other hand, this is kind of insane. C++ is insane. And I'm still not convinced this proposal is more than another bandaid over the fundamental problems with the language. Why do our programming languages keep ending up as terribly complicated and incomplete specifications of scheme or smalltalk?
I don't have a better proposal though and do admire the thought and effort given to retrofitting C++ as a modern language
$class on the other hand is guaranteed not to conflict with any existing code.
1. Interface = abstract class, already present.
2. Reflection, rtti is sparsely used because c++ is primarily used for speed and large teams.
3. Reserved words prefixed by $, etc. Well, outside of a preprocessor directives, that will be a first , if it ever happens.
By the look of the thing, the author wants c++ to be more like c#. But c++ isn't restricting on patterns, we create them. Unlike c# there is no language defined way for dependency injection, interfaces etc. Well we can argue that, but c++ is more flexible on pattern creation, and this proposal wants to put two patterns inside the standard. I just don't see it happening.
2. This is compile-time reflection, which is how a metaclass generates code, so there shouldn't be much of a run-time speed consideration. I think the comparison with C# isn't quite right; if anything, the author wants C++ to be more like Lisp, Smalltalk, or even Python, which all have at least some semblance of a meta-object protocol (and code-writing code, in the case of Lisp).
2. More code at compile time would work. Pythinizing may work. Lisp is quite different.
Keep in mind simple=elegant is not in everybody's eyes.
That being said, I'm also not sure it if will make it to the standard but for different reasons; mainly that it's a pretty huge change and will make C++ even more mature/difficult/one language to rule them all/easier to rant on/...
> "Compile-time programming consists in defining a region in the codeline where the code is meant to be executed at compile time, with the evaluation of compile time data leading to a result. "
Wow, great. So in 2017, C++ is finally able to have a feature that Lisp had since about 1966.
Yes, you can call this comment "smug", but my point is less smug and it's the following:
C++ has been bloated too much. It used to be a nice OO language -perhaps not as elegant as Objective C- but, as the times advanced, good-intentioned people retrofitted more and more characteristics into C++, but the side efects of these "retrofits" is a chaos that is ultimately leading to more criticism of C++ and more people getting interested in alternatives like Julia and Rust.
Julia in particular has a very interesting OOP implementation that includes multiple dispatch, and also has good support for metaprogramming.
Rust, as I see it, is a good alternative to C++, and should also work for systems programming.