-
Notifications
You must be signed in to change notification settings - Fork 48
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
Suggestion of smell: options changing the return type #6
Labels
suggestion of smell
Elixir-specific smells suggested by the community
Comments
lucasvegi
added
the
suggestion of smell
Elixir-specific smells suggested by the community
label
Apr 7, 2022
What do you think about naming this smell as "Alternative return types"? |
Great! |
Hi Valim, I also added this smell to the catalog. I've tried to detail the code examples a little more so the internal structure of the smell is more clear. What do you think? https://github.com/lucasvegi/Elixir-Code-Smells#alternative-return-types |
Beautiful! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Options should not drastically change the return type of a function. For example, you should not have an option that changes the return type. Fictional API:
Because options are optional and sometimes set dynamically, if they change the return type it may be hard to understand what the function actually returns. It is best to introduce a separate function, like
Integer.parse_no_rest
.The text was updated successfully, but these errors were encountered: