-
Notifications
You must be signed in to change notification settings - Fork 5.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow static access to interface function selectors #3506
Comments
Possibly related, or I can create a separate issue. pragma solidity ^0.4.19;
contract TestCase {
function bob() public pure {
}
function TestCase() public {
this.bob.selector;
}
} The error is
Likewise, I do not think this should be a warning. |
Yes, sounds useful. |
It'd also be useful to be able to access these fields in constant initialisers:
|
The main complication for implementing this is that |
For a first step requesting just the feature from the original post. Can add constants as an separate issue. (Which I still support.) Here is a a case found in the wild that shows the problem of not having this feature: constructor(address instanceRegistry, address templateContract) public {
// declare template in memory
Post template;
// set instance type
bytes4 instanceType = bytes4(keccak256(bytes('Post')));
// set initSelector
bytes4 initSelector = template.initialize.selector;
// initialize factory params
Factory._initialize(instanceRegistry, templateContract, instanceType, initSelector);
} They create |
We actually have this implemented for contracts, added probably some time last year. |
Notes from stand up: @fulldecent will do some more testing and update on this |
Top comment updated, test case updated per discussion. |
Since this seems to be non-breaking, I'll add it to 0.6.1. |
Test cases
Actual outcome
Expected outcome
No error.
Discussion
Also need to handle specifying the function where there is function overloading.
Reference: related to ethereum/EIPs#881
The text was updated successfully, but these errors were encountered: