Extend set notation to allow excluding matches #21

Open
opened 2025-10-13 10:01:14 +00:00 by UserCurt · 0 comments
UserCurt commented 2025-10-13 10:01:14 +00:00 (Migrated from codeberg.org)

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.
Sign in to join this conversation.
No description provided.