Prohibiting Duplicate Modifiers
While discussing PR #215, “private protected access modifier,” on the June 2022 TG2 call, @gafter mentioned that prose that disallows duplicate modifiers was missing in some contexts. And rather than adding it to those “missing” places, perhaps we could make a single, general statement re that instead.
The prohibition on having duplicate modifiers is handled in the following ways:
- In the grammar (e.g., §14.12), by allowing only specific individual modifiers or combinations thereof. As such, no prose is needed.
- Explicitly in prose (e.g., §14.2.2.1), by stating, “It is an error for the same modifier to appear multiple times in an xxx declaration.”
- Implicitly in prose (e.g., §14.7.1), by stating, “yyy declarations are subject to the same rules as method declarations with regard to valid combinations of modifiers.” However, this assumes that “valid combinations” includes “no duplicates,” which might not be obvious/sufficient.
All grammar rules containing modifiers use one of the above approaches.
Three rules (property/event/indexer declarations) use the “implicitly in prose” approach, so if that approach is deemed insufficient, we can add words to them. Otherwise, I don’t see any changes are needed.
I think this is now covered in #215 by the changes to writing “permitted kinds of declared accessibility” and the wording of §7.5.2 Declared accessibility
We're not sure whether we want to do this or not, but we'll leave it open as a reminder to try it some time and see if the result feels cleaner.
Pre-meeting evaluation: just remove the "meeting-discuss" label for now, and revisit after we've finished the C# 7 features?
Yup: low priority, but shouldn't just be closed.