jbcoe / jbcoe/cc-protocol

Should an unqualified interface member allow two dispatch paths?

Open
#268 1 comment 0 reactions 0 assignees View on GitHub
design
Dominant language
C++
Stars
11
Forks
4
Avg merge
16h 39m
Merged PRs (30d)
131

Description

For example:

```c++
struct Interface {
int foo();
};

struct A {
int foo() && { return 1; }
int foo() & { return 2; }
};

protocol p{A{}};
p.foo(); // 2.
std::move(p).foo(); // 1?
```

This would require us to generate two vtable entries for `int foo()`. Alternatively, we could say that `T` only conforms if it provides `int foo()` as one member function without overloading.

Contributor guide

Open the contributing guide

Research direction

Start with the protocol example and trace how an unqualified Interface::foo is represented, how A's ref-qualified overloads are checked, and how dispatch is selected. Compare the two alternatives in the issue—two vtable entries or requiring one unoverloaded member—and document the chosen conformance and dispatch behavior for both calls.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.