-
Notifications
You must be signed in to change notification settings - Fork 757
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
Docs: Set / SortedList added details regarding equality checks. #5131
Docs: Set / SortedList added details regarding equality checks. #5131
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.
Thank you @miriamvoth for wanting to take care of this!
Looks ok to me! Proposed a few changes.
Just to be sure: is the purpose of this to be really explicit about when functions check equality vs. identity? It looks like, across the class library, most functions check for equality unless they explicitly specify that they check for identity. The only counterexamples I've found are indexOf checking for identity VS. indexOfEqual checking for equality, and the same for includes VS includesEqual.
I think a lot of confusion comes from different Collections having different includes, some checking for equality and some for identity. So, together with documenting every method as we're doing here, we should make sure to document those different "includes", for example Set:includes is not documented.
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.
had lost all my code-comments in my previous comment. Here they are again
HelpSource/Classes/SortedList.schelp
Outdated
@@ -5,7 +5,7 @@ categories::Collections>Ordered | |||
CLASSMETHODS:: | |||
|
|||
method::new | |||
Creates a SortedList with the initial capacity given by strong::size:: and a comparison strong::function::. | |||
Creates a SortedList with the initial capacity given by strong::size:: and a comparison strong::function::. The SortedList can contain equal elements more than once. |
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.
If we really want to state that SortedList can contain duplicates (maybe superfluous IMO since this is what most Collections do), then we should say "equal or identical"
HelpSource/Classes/Set.schelp
Outdated
@@ -74,6 +75,7 @@ a -- b // shorter syntax | |||
|
|||
method::isSubsetOf | |||
Returns true if all elements of this are also elements of strong::that::. | |||
Checks for equal elements regardless of the order inside the set. |
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.
Set is unordered. While I think it doesn't hurt to state that again, maybe it should be in a form that supports a more solid knowledge of this important property?
Example:
"Checks for equality (not identity). Since Set is an unordered collection, order doesn't matter in this comparison"
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.
Sounds good. I just took your sentence.
HelpSource/Classes/Set.schelp
Outdated
@@ -41,23 +41,23 @@ Returns the object at the internal strong::index::. This index is not determinis | |||
subsection::Set specific operations | |||
|
|||
method::sect, & | |||
Return the set theoretical intersection of this and strong::that::. | |||
Return the set theoretical intersection of this and strong::that::. The function will search for strong::equal:: objects occurring in both sets and return a new set containing those. |
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.
for ::sect and ::union I would personally stick to the "equality (not identity)" style you use everywhere else. Also "equal (not identical)" would be fine for me.
Hi @elgiano, thanks for your feedback. |
Hi @miriamvoth! I want to make sure you know that I absolutely don't intend to take your work down in any way! I agree it would be better to be explicit about equality vs. identity than to be implicit, and it's great that you are willing to take care of that! I think it would be great to:
I would move on with this as follows:
EDIT: and of course if this whole process feels overwhelming or in any way too much work for you, absolutely feel free to do only as much work as you feel good about doing! Contribution is totally voluntary and every contribution is really appreciated! :) Finally, if we will come up with a summary of differences among Collections, I think we could put in a paragraph about it.. maybe in Collection's HelpFile Description section? And in case this could help you, by writing |
@elgiano just for context, i specifically told @miriamvoth that for this initial PR they should only document a few items, so that we can get a pattern that we like, before going on to document more. that first step is the hardest in my opinion. :) |
@elgiano thanks for your detailed answer :) I included your suggestions in my new commit and went for a more unified wording with the equal (not identical). For Set I also documented the functions .includes() and .findMatch() now and I will keep an eye on .includes and .indexOf in the next classes to come. |
@miriamvoth thanks, and sorry for my delay! If you agree with me, this could be a possible replacement: What do you think? |
fwiw, i think your suggested replacement is clearer. "check for equality" is more common than "check by equality", i think. for example: https://dotnetcodr.com/2017/03/18/equality-checking-in-f/ and all elements, not just matches, are checked. so i'd amend that to: "Elements are checked for equality (not for identity)" |
Yeah, I was also wondering, if the sentence might be misunderstood without context. Especially since I am not a native speaker, it is hard for me to tell. I will change the sentence accordingly. |
b1531d8
to
358f85f
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.
thanks! sorry for the long delay, everything looks good
Purpose and Motivation
Added information to the help files Set.schelp and SortedList.schelp, if a function checks for equality or identity.
Connected to #4573 (not fully fixing the issue yet)
Types of changes
To-do list