-
-
Notifications
You must be signed in to change notification settings - Fork 174
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
Clarify documentation for 'list.group' #725
base: main
Are you sure you want to change the base?
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.
Remove the guarantee that it is reversed please.
7fd5e1e
to
2f21792
Compare
Sure, "may be reversed" alright? Is the reasoning behind this that strictly speaking reversing only happens (as a side effect) when group size > 1 or am I missing something? |
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.
Please remove the comment on it being reversed. The previous documentation was accurate.
Sorry for being obtuse, but I feel like there's still some misunderstanding on either end. Allow me to try to elaborate
Right, but isn't it also rather ambiguous? Without prior knowledge of the implementation details, "Does not preserve the initial value order." can be interpreted to mean that the order is reversed, random or anything else in between. |
I think the idea is that changing the implementation in the future would not be a breaking change. The order is not guaranteed. Right now it's reversed, but you should not rely on that in any way as is not part of the API. |
@voneiden You are attempting to change the contract that we the Gleam maintainers have with the users of this code. Any such changes cannot be made via a pull request with no prior discussion. |
Aha, I see now, thanks. "Not guaranteed" would have been much better wording than "not preserved", although I doubt the former interpretation was the intent of the author. Even @lpil suggested in the implementing PR that users can reverse the lists themselves if they need the values in original order. Considering that, changing the ordering in the future without it being considered a breaking change would seem rather dangerous to me. Yes, there's a contract and you can certainly appeal to it, but as can be seen, I failed to understand it correctly. Perhaps I'm the first, but I doubt I will be the last. Would it be best to close this PR and I proceed by creating an issue for further discussion? |
2f21792
to
c8cdde1
Compare
Reworded the summary line to use similar structure as other function summaries in the list module and made the note about not preserving initial value order be more specific.
While in hindsight it makes sense what "does not preserve" means, and it can also be deducted from the supplied examples, at least for me it wasn't obvious at first glance and I ended up looking at the source code for answers.