Skip to content
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

Add an 'unused' modifier #125

Open
rkalis opened this issue Jun 13, 2022 · 5 comments
Open

Add an 'unused' modifier #125

rkalis opened this issue Jun 13, 2022 · 5 comments
Labels
cashc-compiler Relates to the cashc compiler enhancement New feature or request good first issue Good for newcomers

Comments

@rkalis
Copy link
Member

rkalis commented Jun 13, 2022

Allow variables and parameters to have an unused modifier that indicates it is ok for them to be unused.

contract Test(int unused a, int b) {
    function test(int c) {
        require(b == c);
    }
}
@rkalis rkalis added enhancement New feature or request good first issue Good for newcomers cashc-compiler Relates to the cashc compiler labels Jun 13, 2022
@rkalis
Copy link
Member Author

rkalis commented Jun 13, 2022

@nathanielCherian looks like we might need an array of modifiers after all 😬

@nathanielCherian
Copy link
Contributor

Wow, we were just talking about how there couldn't possibly be more modifiers😂

The array of modifiers code is saved on one of my branches so I'll look into that again and try implementing the new unused modifier.

@nathanielCherian
Copy link
Contributor

Hey! Currently working on this and I had a question about the implementation.

As of now, the constant keyword can only be applied to variables (not ParameterNodes). Should we extend the constant keyword to parameters as well?

Also for the unused modifier, do you see this being used for parameters exclusively or include VariableNodes too?

@rkalis
Copy link
Member Author

rkalis commented Mar 22, 2023

Hey @nathanielCherian! Sorry, I completely missed this comment, apologies for the late reply!

I think the unused modifier should apply to parameters and variables. The constant modifier I'm not super sure, but maybe for consistency we can also apply it to parameters.

@mr-zwets
Copy link
Member

mr-zwets commented Nov 5, 2024

Having an unused modifier is a solution to the same problem as just allowing for unused variables but adding a warning (#187)

regarding the for an 'array of modifiers', I suggested the possibility of an anchor keyword for contract constructor arguments in #217

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cashc-compiler Relates to the cashc compiler enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

3 participants