4 ms·
1. It's about abstracting what "classes" are, since the built-in "class" metaclass is trying to be one-size-fits-all. Yes, an interface is an abstract class, a
by kmill 9y ago
1. It's about abstracting what "classes" are, since the built-in "class" metaclass is trying to be one-size-fits-all. Yes, an interface is an abstract class, and if you could do things like make your own "interface" metaclass, then you can "create more patterns," in your words.
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).
- quickben 9y ago1. Classes itself can be improved, but at this point, will they date breaking compatibility? Maybe from that perspective this will be given a shot. 2. More code at compile time would work. Pythinizing may work. Lisp is quite different.
- moomin 9y agoIndeed. I think this is one of the best things about the proposal: it offers a way out of the current hardcoded behaviours. At the moment we barely even think about whether or not they're correct, because they're obviously too hard to opt out of.