-
Notifications
You must be signed in to change notification settings - Fork 614
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
SmartDashboard.setDefault*
documentation
#6490
SmartDashboard.setDefault*
documentation
#6490
Conversation
/format |
7ee6a8a
to
c0a8d08
Compare
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.
SmartDashboard.h
needs to be fixed similar to java everywhere it says this:
Gets the current value in the table, setting it if it does not exist.
* @param defaultValue the default value to set if key does not exist. | ||
* @return False if the table key exists with a different type | ||
* @param defaultValue the value to set if key does not exist | ||
* @return True: success; False the key already existed |
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.
* @return True: success; False the key already existed | |
* @return True if the key did not already exist, otherwise false |
ditto for all others for consistency
Addressing them in the same PR would be fine
I think an appropriate wording would be
|
c0a8d08
to
13024a7
Compare
Still WIP |
… also fix description of defaultValue parameter for some Get* methods where the comment said that the value in the table would be set by the Get method
13024a7
to
9ffb250
Compare
I think this is ready for re-review. While I was fixing SmartDashboard.h I noticed that the Get* methods also were erroneous in saying that their defaultValue would be "set" if the key was not in the table, so I fixed those too. |
I would like to address #6334, but realized that some discussion about how the behavior should be documented would help before changing all of them. The code diff here contains a proposal that reflects my understanding of the actual behavior.
Questions:
NetworkTableEntry.java
,NetworkTablesJNI.java
,ntcore_c.h
, andntcore_cpp.h
also be addressed in the same PR, or in a second PR specific to the ntcore component?More details about
NetworkTableEntry.java
,NetworkTablesJNI.java
,ntcore_c.h
, andntcore_cpp.h
:SetDefault*
methods inNetworkTableEntry.java
called bySmartDashboard.setDefault*
document the return value as@return False if the entry exists with a different type
whereas the actual behavior is@return False if the entry exists
. Interestingly, the descriptive documentation here isSets the entry's value if it does not exist.
which is correct.The next level down is
NetworkTablesJNI.java
. Here the documentation iswhich is correct but doesn't identify criteria for success.
On the C/C++ side:
ntcore_c.h
hashaving both the "Returns a copy of..." error and lack of specificity about success.
ntcore_cpp.h
has essentially the same issues asntcore_c.h
.