static validation of closed overrider sets

Open
#137 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
35/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Active
Tech stack
cpp
Domain
compilers

Research direction

Start by reading the BOOST_OPENMETHOD interface and the project’s compile-time dispatch and ambiguity-checking code; the issue provides no file or test names. Determine how a declared set of overriders could be checked for missing or ambiguous virtual tuples while allowing later specializations, then add coverage for those cases. Done means the compile-time guarantee works for the declared set and the documented limitation for later specializations is clear.

Written by the indexing model from the issue text.

Description

enhancement explore

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.

Dominant language
C++
Stars
14
Forks
7
Avg merge
3d 3h
Merged PRs (30d)
15

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from boostorg/openmethod

All issues in boostorg/openmethod

Similar issues

More C++ issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.