Even if attributes continue to be standardized by continuing objections from both two providers, which are cited as the main prior art, we can live with them, with the exception of virtual override controls. This result is simply terrible, as already shown in the example in 7.6.5 (excerpt):
class D [[base_check]] : public B { void some_func [[override]] (); virtual void h [[hiding]] (char*); };
Here we have six keywords (not counting void
and char
): three normal keywords and three words [[decorated]]
. There has already been public mockery of C ++ 0x about this ugliness. It's just a bad language design, even in the face of backward compatibility (for example, that some existing code can already use these words as identifiers), since these problems have already been solved in other ways in existing practice (see below). More importantly, it is precisely the misuse of attributes as disguised keywords that were opposed and clearly promised that this would not happen, to get this offer passed. Using attributes for virtual control keywords is the most egregious abuse of attribute syntax, and the use of attributes should be fixed by replacing them with non-attribute syntax. These virtual override controls are linguistic and not annotations.
It is possible to have good names and no conflicts with existing code using contextual keywords, such as recognizing that the word has special meaning when it appears in the grammar position, where the user identifier cannot appear, as demonstrated in C ++ / CLI, which has five years of actual field experience with a large number of clients (and certainly not the name of conflicts or problems with the confusion of programmers, these five years were available):
class D : public B { void some_func() override;
The above forms are realizable, implemented, have years of practical field experience and work. Developers love them. Whether the answer is to follow this existing practice or something else, there should be a more natural replacement for [[attributed]]
keywords for virtual redefinition management, which is an ugly novelty that has no field experience and what developers have already ridiculed.