Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-81397

IDL: replace kNum${enumType} with generic-friendly trait

    • Type: Icon: Improvement Improvement
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 7.2.0-rc0
    • Affects Version/s: None
    • Component/s: None
    • None
    • Fully Compatible
    • Service Arch 2023-10-02

      In researching SERVER-81394 (targeting Boost.Preprocessor usage specifically), I found a very heavy Boost.Preprocessor macro system to implement sophisticated macro system for resharding metrics. I mean it's really an achievement in its own right. However, it immediately occurred to me that this was a workaround.

      It was only really necessary because of an IDL generator problem. We must use preprocessor token-stitching to produce the name of a trait of an IDL-generated enum trait kNum##name for the enum name. If we make a very small change to IDL, we can just specialize a trait e.g. idlEnumCount<name> instead, and vastly simplify the resharding metrics registration code I encountered. And we'd unlock other beneficial uses in code for teams that aren't currently in a position to put that much engineering time into a workaround.

      And it's a very small and simple change! We don't really use this trait much.

            Assignee:
            billy.donahue@mongodb.com Billy Donahue
            Reporter:
            billy.donahue@mongodb.com Billy Donahue
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: