Reject every interface member that uses a reserved name, static members included
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 48/100
- Issue type
- Feature
- Clarity
- Mostly clear
- Activity status
- Active
- Tech stack
- cpp
- Domain
- devtools, documentation, testing
Research direction
Start with protocol_interface_function_infos, named_member_function_infos, and the StaticInterfaceMemberWithReservedNameIsIgnored test to understand the current filtering. Review DRAFT.md's “Reserved member names” section and the rejected/ignored lists in #407, then confirm the intended rule with the issue options. Done means the selected behavior is covered by tests and the related documentation and reserved-name lists are consistent.
Written by the indexing model from the issue text.
Description
Follow-up to #318, from the review of #449: https://github.com/jbcoe/cc-protocol/pull/449#discussion_r4057463300
#449 rejects a non-static interface member function named allocator_type, get_allocator or swap. A static member function with one of those names is skipped before the check, like every other static:
struct I {
static void swap(I&, I&) noexcept; // accepted and ignored
};
Nothing is hidden today, because interface statics are not forwarded. The case for rejecting it anyway:
- The rule is simpler to state: an interface cannot declare a member with a reserved name.
- Removing
staticlater turns an accepted interface into a rejected one. - If interface statics are ever forwarded, the reserved name would hide the generated member silently, which is what #318 set out to stop.
The same argument covers members the check never sees. named_member_function_infos filters on is_function, so a data member, static data member, alias or nested type with a reserved name is accepted too:
struct I {
using allocator_type = int; // accepted and ignored
int swap; // accepted and ignored
};
Options:
- Reject a static member function with a reserved name. Move
has_reserved_member_nameabove theis_static_memberskip inprotocol_interface_function_infos. - Reject any member with a reserved name, whatever its kind. Walk
members_ofthe interface once, before the function filter. - Leave statics and non-function members ignored, and say so in DRAFT.md.
2 gives the rule DRAFT.md can state in one sentence. Other statics stay ignored either way (#211, #403).
To change with it: the StaticInterfaceMemberWithReservedNameIsIgnored test, the "non-static member function" wording in DRAFT.md's "Reserved member names", and the rejected/ignored lists in #407. #450 adds protocol and protocol_view to reserved_member_names; the same rule should apply to them.
- Dominant language
- C++
- Stars
- 11
- Forks
- 4
- Avg merge
- 15h 44m
- Merged PRs (30d)
- 145
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from jbcoe/cc-protocol
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
jbcoe/cc-protocol#407 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
jbcoe/cc-protocol#194 · 1 comment ·
-
Difficulty 5/5 Over a week Newbie friendliness 35/100
jbcoe/cc-protocol#453 ·
-
Difficulty 5/5 Over a week Newbie friendliness 20/100
jbcoe/cc-protocol#451 ·
-
Private members of protocol and the generated bases' class names hide interface member functions Open
Difficulty 4/5 3-5 days Newbie friendliness 48/100
jbcoe/cc-protocol#450 · 1 comment ·
All issues in jbcoe/cc-protocol
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
-
Sensor initialization takes very long when `--initial-sim-time` is set to current UNIX timestamp Open
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
gazebosim/gz-sensors#662 · 1 comment ·
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
-
comp-datalake
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
ClickHouse/ClickHouse#121222 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
LadybirdBrowser/ladybird#12123 ·