-
Notifications
You must be signed in to change notification settings - Fork 38
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
Refactored output parameter. #115
Refactored output parameter. #115
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not a fan of this approach, but I won't block this PR for that. I think we should definitely focus on the error handling part more in the future. std::expected or boost::checked is a good tip
791d1d4
to
efcda2c
Compare
3830028
to
c615c89
Compare
I'm a bit puzzled. I created what I think was a very innocuous PR which is in-line with a best practice which is widely supported within the C++ community. Yet, for such a small change, I get quite a bit of pushback from both @Rayman and @Timple . So I was hoping you two would explain to me what you don't like about this. So I can perhaps address your concerns or refrain from these kind of changes in the future. Is it the principle of no output parameters itself, the usage of |
PR comments often sound a bit harsh as good stuff is rarely complemented 🙂 . I actually liked to learn about the My comment was that you are refactoring a function which doesn't describe it's actual use. But these kind of comments can simply be split-off to issues and the PR can continue: #120 |
I think we were hoping and suggesting some bigger changes to the error handling that are needed, while you made a small improvement to existing code. I sometimes use a review to comment on code that surrounds the block of code because that's the first time I'm really looking at it. I shouldn't do that and focus more on the current review. |
Refactored
TrackingPidLocalPlanner::computeVelocityCommands()
to use a return value instead of an output parameter.The function never read from the output parameter (it was pure output and not in-/output), and the results were one of the following:
This maps perfectly to
std::optional
. Either the function is successful and it returns the velocity command or it is not successful and it does not return a velocity command.