Syntax to refer to a specific overload of a function
- Dominant language
- C++
- Stars
- 25.7k
- Forks
- 6.2k
- Avg merge
- 1d 11h
- Merged PRs (30d)
- 21
Description
```
pragma experimental "v0.5.0";
contract Selector {
function transfer(address, uint) external;
function transfer(address) external;
function calculateSelector() public pure returns (bytes4) {
return this.transfer.selector;
}
}
```
Not sure what could be a good notation and/or a generic way for this. As a workaround a function type can be defined.
Split off #3544.
EDIT by @cameel: Renamed the issue since we often defer to it as the main issue about resolving ambiguous overloads. The original title was `Support retrieving selector of an overloaded function`.
Contributor guide
Research direction
No source file or test is named. Start with the overloaded transfer declarations and the this.transfer.selector expression, then review the discussion and linked issue #3544 for any agreed notation or constraints. Done means the ambiguity has a defined resolution and is covered by compiler tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, solidity
- Domain
- blockchain, compilers
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 24/100