[SERVER-40811] Eliminate MONGO_INITIALIZER kruft Created: 24/Apr/19 Updated: 06/Dec/22 Resolved: 08/Dec/20 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Internal Code |
| Affects Version/s: | Needs Further Definition |
| Fix Version/s: | None |
| Type: | Improvement | Priority: | Major - P3 |
| Reporter: | Billy Donahue | Assignee: | Backlog - Service Architecture |
| Resolution: | Duplicate | Votes: | 1 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||||||||||||||
| Assigned Teams: |
Service Arch
|
||||||||||||||||||||
| Sprint: | Dev Tools 2019-05-20, Dev Tools 2019-06-03, Dev Tools 2019-06-17, Dev Tools 2019-09-09 | ||||||||||||||||||||
| Participants: | |||||||||||||||||||||
| Description |
|
MONGO_INITIALIZER has some unnecessary API complexity. We don't need: `MONGO_INITIALIZER` can instead take a name and 2 optional parameters. MONGO_INITIALIZER(name) The preprocessor can handle this with a `_VA_ARGS_` arity selector idiom. We do not need the make_string_vector.h,cpp files at all. We can just have the MONGO_INITIALIZER macro directly create `vector<string>` to give the registration API as temporaries and we can more gracefully handle empty lists as () instead of (NULL). At that point we don't need the MONGO_NO_PREREQUISITES or MONGO_NO_DEPENDENTS macros because the `()` is easier to remember than `(NULL)`. |
| Comments |
| Comment by Billy Donahue [ 09/Dec/20 ] | ||||||||
|
That commit was intended to be labeled with | ||||||||
| Comment by Githook User [ 08/Dec/20 ] | ||||||||
|
Author: {'name': 'Billy Donahue', 'email': 'billy.donahue@mongodb.com', 'username': 'BillyDonahue'}Message:
| ||||||||
| Comment by Billy Donahue [ 14/Jun/19 ] | ||||||||
|
Steps:
Something like what java has with static initialization blocks.
Then lots of code can be grouped together into the MONGO_STATIC_INITIALIZER block. We wouldn't need a separate dummy per globally initialized thing, and we wouldn't need a macro for each kind of static-init dummy (MONGO_INITIALIZERs are just one of several kinds of things registered at static init time). Possible Implementation. It's the same trick as MONGO_INITIALIZER uses now, essentially, but without the initializer-specifics.
| ||||||||
| Comment by Githook User [ 16/May/19 ] | ||||||||
|
Author: {'name': 'Billy Donahue', 'email': 'billy.donahue@mongodb.com', 'username': 'BillyDonahue'}Message: | ||||||||
| Comment by Githook User [ 30/Apr/19 ] | ||||||||
|
Author: {'name': 'Billy Donahue', 'username': 'BillyDonahue', 'email': 'billy.donahue@mongodb.com'}Message: | ||||||||
| Comment by Billy Donahue [ 29/Apr/19 ] | ||||||||
|
This review went much further, into replacing MONGO_INITIALIZER altogether with a builder pattern. Will put off any pursuit of this until at least post v4.2, as it affects a lot of code with hand-edits. |