-
Notifications
You must be signed in to change notification settings - Fork 417
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
Should rclcpp::Parameter throw if trying to stringify an unset parameter? #1348
Comments
Just to be clear, if you have the following code:
What you get as output is:
That seems really non-intuitive to me. It's kicking the can down the road to users; to be really robust, users would have to check for this magic string anyway. |
I don't see anything wrong with stringifying a |
But its an arbitrary string that doesn't mean anything. Worse, it sort of converts the type into a string, so after stringifying it you can't really tell the difference between a NOT_SET parameter and a STRING parameter that happened to contain the string "not set". For me, it seems like it should be an error to try to stringify a NOT_SET parameter. The result can only be undefined, and so I think we should throw an exception here. |
I think as long as user can see and tell the difference NOT_SET and STRING after stringifying, that would be no problem. but if it cannot, it would be nice to notify the user application. |
In the case of
The one that might be a problem is
IMO, the output of those should be:
as parameter value is actually a "variant", a "debug" stringified version of it should include the type. |
This is a follow-up issue to a comment left by @clalancette over at #1344.
Currently rclcpp::Parameter will convert an unset parameter into a string if requested (either by
to_string
or using the<<
operator). Should this be expected or should it throw some sort of exception?The text was updated successfully, but these errors were encountered: