1
0
Fork
You've already forked mpath
0

Extend set notation to allow excluding matches #21

Open
opened 2025年10月13日 12:01:14 +02:00 by UserCurt · 0 comments

This issue proposes new syntax extending sets from #3 to exclude matches. The proposal uses a set difference approach.

One proposed syntax is to deliminate within the set syntax. Using a hyphen, an example would be /X/{* - A}/Y where * would match all fields of X and A would be removed from this set. An alternative proposed syntax is to deliminate outside the set syntax, such as in /X/{*}-{A}/Y, though in this syntax it may not be immediately clear to the user that {*}-{A} acts as a unit.

Commas are union operations as normal from #3 not only for the inclusion side but also the exclusion side in the set difference, like in /X/{A*, B*, C* - A1, ?2, C?*}/Y. This is one aspect of the alternative syntax that may be better as each side of {A*, B*, C*}-{A1, ?2, C?*} in /X/{A*, B*, C*}-{A1, ?2, C?*}/Y is clearly an independent set.

It is unclear at this time how this would interact with #19. Perhaps set differences could apply to not just individual fields but whole arrays of segments. An open question would be whether A/B/C should be removed from /A{/*/C - /B} or not. My intuition says no as you would need to do /A{/*/C - /B/C} to do that.

This issue proposes new syntax extending sets from #3 to exclude matches. The proposal uses a set difference approach. One proposed syntax is to deliminate within the set syntax. Using a hyphen, an example would be `/X/{* - A}/Y` where `*` would match all fields of `X` and `A` would be removed from this set. An alternative proposed syntax is to deliminate outside the set syntax, such as in `/X/{*}-{A}/Y`, though in this syntax it may not be immediately clear to the user that `{*}-{A}` acts as a unit. Commas are union operations as normal from #3 not only for the inclusion side but also the exclusion side in the set difference, like in `/X/{A*, B*, C* - A1, ?2, C?*}/Y`. This is one aspect of the alternative syntax that may be better as each side of `{A*, B*, C*}-{A1, ?2, C?*}` in `/X/{A*, B*, C*}-{A1, ?2, C?*}/Y` is clearly an independent set. It is unclear at this time how this would interact with #19. Perhaps set differences could apply to not just individual fields but whole arrays of segments. An open question would be whether `A/B/C` should be removed from `/A{/*/C - /B}` or not. My intuition says no as you would need to do `/A{/*/C - /B/C}` to do that.
UserCurt added this to the Someday milestone 2025年10月13日 12:01:14 +02:00
Sign in to join this conversation.
No Branch/Tag specified
main
dev
functional
Milestone
Clear milestone
No items
No milestone
Projects
Clear projects
No items
No project
Assignees
Clear assignees
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
UserCurt/mpath#21
Reference in a new issue
UserCurt/mpath
No description provided.
Delete branch "%!s()"

Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?