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

fix: return variable names consistency #156

Merged
merged 3 commits into from
Jul 15, 2024
Merged

Conversation

wei3erHase
Copy link
Member

Addressing @turtlemoji comments on return variable name consistency, this is the approach that was chosen:

  • maintain methods as they were, with return variable names w/o explicit returns:
function myMethod() public returns (uint256 myReturn) {
    myReturn = calc();
    // notice: no `return myReturn`
}
  • removing all obvious view method return variable names (for explicit returns):
function getValue() public returns (uint256) {
    // notice: no `_myValue = value`
    return value;
}
  • BMath contract was deliberately chosen to maintain the named returns (despite being views)
  • non-obvious view returns were also chosen to be named, such as:
function getValidSignature() public returns (uint256 magicValue){
    magicValue = magic();
    // notice: this one could have been `return magic();`
}

@wei3erHase wei3erHase merged commit 4a4f8d3 into dev Jul 15, 2024
4 checks passed
@wei3erHase wei3erHase deleted the fix/return-name-consistency branch July 15, 2024 17:42
@0xteddybear 0xteddybear mentioned this pull request Jul 15, 2024
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants