Skip to content

static validation of closed overrider sets #137

Open

Description

@jll63

Inspired by https://github.com/Boumg/mini-openmethod.

Many reasonable applications of open-methods require only semi-openness, i.e. the ability to add polymorphic behavior to existing class hierarchies, without the need to specialize existing methods. In that case, the method could optionally specify a set of overriders, which would be checked at compile time for missing or ambiguous virtual tuples. The mechanism could naturally extend BOOST_OPENMETHOD:

BOOST_OPENMETHOD(
    poke, (virtual_ptr<Animal>, std::ostream& os), void,
    [](virtual_ptr<Cat>, std::ostream& os) {
        os << "hiss";
    },
    [](virtual_ptr<Dog>, std::ostream& os) {
        os << "bark";
    }
);

User would retain the ability to add specializations afterwards, but then the compile time guarantee would be off.

Activity

  1. added
    enhancement
    on Oct 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementexplore

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions