CashScript / cashscript

⚖️ Easily write and interact with Bitcoin Cash smart contracts
https://cashscript.org
MIT License
112 stars 79 forks source link

Add an 'unused' modifier #125

Open rkalis opened 2 years ago

rkalis commented 2 years ago

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 commented 2 years ago

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

nathanielCherian commented 2 years ago

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 commented 1 year ago

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 commented 1 year ago

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.