-
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
Add (and require) keyword for the default state mutability of functions #9248
Comments
"mutable" might be more appropriate than "mutating". Looks more appropriate in a sentence. The function |
@hrkrshnn I think I disagree - the function is mutating the contract's state, it is not that the function itself is modified. |
@chriseth I think 'mutating' doesn't fit with the existing tags: pure, view, payable. It would fit better if it was 'viewing' instead of 'view'. Maybe 'mutable' isn't a good replacement, since it has a different meaning in other languages. |
It would be nice if the form of the word was of similar form with |
We could also use |
Ugh, while I can appreciate that it would resolve the requirements I mentioned (something that can be searched for and is immediately visible), I have a pretty strong disdain for abbreviations in code. 😖 |
Another suggestion: impure. |
|
Another option: in Ruby names can contain characters like We could also require the object to be an explicit parameter: If we want a keyword though - what about |
Idea that came up in the design meeting: make the default |
I would still prefer explicit labels for everything, though if you are going to default then I think defaulting to |
I agree with |
We should perhaps also consider #3221 under the same discussion. |
I think
Useless blurb: Initially I was going to argue for We could also consider moving to a different system, for example the following: Consider everything pure by default and introduce a new field/modifier called Examples:
Arguable as we have established some of these states imply others, such as it would be unrealistic to have a payable function which does not reads or writes -- albeit possible which does not "writes" if we assume balance changes not caused by the contract do not mean "writing". |
Wish to add more flags:
|
Hi everyone! This issue has been closed due to inactivity. |
Proposals:
!
Reason for requiring the keyword:
cc @MicahZoltu
The text was updated successfully, but these errors were encountered: