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

expression for some #7

Open
Gozala opened this issue Feb 26, 2024 · 2 comments
Open

expression for some #7

Gozala opened this issue Feb 26, 2024 · 2 comments

Comments

@Gozala
Copy link

Gozala commented Feb 26, 2024

We had various sketches and discussions around how to support some notation. To be honest I am not sure we need dedicated syntax because [] in the selector effectively gives you that.

On the other hand I also argue in #5 that jq is little ambiguous there and perhaps it would make more sense to do something like this instead

{
  "mail": [
    { "to": ["[email protected]"], "message": "hello" },
    { "to": ["[email protected]"], "message": "hello" }
   ]
}
[
  [".mail", "?", "?mail"],
  ["in", "?message", "?mail"]
]

Which is same as this (with a current selector syntax

[
  [".mail", "?", "?mail"],
  [".[]", "?mail", "?message"]
]
@expede
Copy link
Member

expede commented Feb 27, 2024

Defaulting to universal quantification has been universally (ha!) preferred 👍

@QuinnWilton had a good phrasing for why:

In database queries, you want to filter out all counterexamples. In validation, you want to know that there are no counterexamples
[Paraphrased]

@expede
Copy link
Member

expede commented Feb 27, 2024

When asked about which was preferred:

["some", ".foo.bar.[]", "?x"]
[">", "?x", 0]

["in", ".foo.bar.[]", "?x"]
[">", "?x", 0]

["any", ".foo.bar.[]", "?x"]
[">", "?x", 0]

["exists", ".foo.bar.[]", "?x"]
[">", "?x", 0]

some was the favourite by strong preference. It makes an analogy to JS's .some() function, plus in logic you say "there exists some x where ...", so it works for that crowd, too

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

No branches or pull requests

2 participants