jsonptr icon indicating copy to clipboard operation
jsonptr copied to clipboard

`Pointer::union` is misleadingly named

Open asmello opened this issue 1 year ago • 3 comments
trafficstars

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.

asmello avatar Mar 19 '24 22:03 asmello

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

I'll deprecate it and rename for 0.4.

chanced avatar Mar 19 '24 22:03 chanced

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

asmello avatar Mar 19 '24 22:03 asmello

I meant I’ll rename it but alias the existing, improperly named, fn to the new and deprecate it.

On Tue, Mar 19, 2024 at 6:52 PM André Mello @.***> wrote:

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

— Reply to this email directly, view it on GitHub https://github.com/chanced/jsonptr/issues/28#issuecomment-2008296933, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAIGFZENJSYNNZ6U3CZUDV3YZC6ULAVCNFSM6AAAAABE6NR66OVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAMBYGI4TMOJTGM . You are receiving this because you commented.Message ID: @.***>

chanced avatar Mar 19 '24 23:03 chanced