Proposal to enumerate selectors on the Contract type

type(MyContract).selectors returns bytes4[]

When working with multi-contract architectures, such as ERC-2535 Diamond proxies, it’s often necessary to handle method selectors directly. Using MyContract.myMethod.selector requires the programmer to manually reference each method by name, and to keep these updated as interfaces are added and modified. Using the keccak hash is worse, since it relies on magic strings which are error prone and cannot be validated until runtime.

In effect, this request is to have reflection information, equivalent to the ABI, available within the code environment.

This accessor would also provide a way to access selectors for overloaded methods with the same name, but different parameter signatures.

For completeness, the .selectors keyword should also be applied to Interface and Library types.