-
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
Consider removing "named returns" #1401
Comments
I've always really liked the named returns feature of Solidity. If anything |
I would love to see us drop named returns altogether. I think it improves code readability to be explicit about returns. |
We already have #973 (comment) for the first three examples. I think named returns in general are a great idea for readability - it will tell the user the meaning of the return value.
|
For readability, can the meaning of the return value be expressed as a code comment? "being able to assign to the return value" is that this example?
Or is the example a case of "non-explicit return in a function returning a value"? Here's another "bad" one (0 will be returned):
|
The "named" returns feature is another quirky one that gets burdened on Solidity writers and reviewers to get correct.
|
Hi everyone! This issue has been closed due to inactivity. |
Related to #719, #973, #708. Grouping the examples here.
These behaviours can be confusing for people who are starting out with the language. Solidity has been criticized as a language that hasn't been designed with safety in mind, and this is one feature where safety was overlooked imo.
And another:
One more:
A case where the explicit return statement is "overshadowed" by the named return.
Instead of
somethingComplexThatReturnsFalse
imagine a bunch of other code and loops.The text was updated successfully, but these errors were encountered: