Skip to content
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

Pointer::union is misleadingly named #28

Closed
asmello opened this issue Mar 19, 2024 · 3 comments · Fixed by #30
Closed

Pointer::union is misleadingly named #28

asmello opened this issue Mar 19, 2024 · 3 comments · Fixed by #30

Comments

@asmello
Copy link
Collaborator

asmello commented Mar 19, 2024

When used as an operator, the term union conventionally alludes to the set theoretical definition. From Wikipedia:

In set theory, the union (denoted by ∪) of a collection of sets is the set of all elements in the collection.

In more concrete terms, when given two sets of items, their union is the set of all elements from either set. So when the term is applied to a JSON Pointer, one might expect that the result would somehow contain the tokens from both inputs, when in reality it only contains their shared part. This more accurately represents an intersection operation, which is the opposite of a union, so the naming is surprising and easily leads to confusion.

The most accurate term would be longest common prefix, as this is the algorithm that the method implements. To keep it short, the abbreviation lcp is often used. I think intersection would probably also be fine, though.

@chanced
Copy link
Owner

chanced commented Mar 19, 2024

Ugh, thank you. That one is especially embarrassing 🤦🏻‍♂️.

I'll deprecate it and rename for 0.4.

@asmello
Copy link
Collaborator Author

asmello commented Mar 19, 2024

Awesome! I think you meant the rename for 0.5 though? We are at 0.4.x releases.

@chanced
Copy link
Owner

chanced commented Mar 19, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants