ucan-wg / delegation

1 stars 1 forks source link

expression for `some` #7

Open Gozala opened 6 months ago

Gozala commented 6 months ago

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": ["alice@web.mail"], "message": "hello" },
    { "to": ["bob@gmail.com"], "message": "hello" }
   ]
}
[
  [".mail", "?", "?mail"],
  ["in", "?message", "?mail"]
]

Which is same as this (with a current selector syntax

[
  [".mail", "?", "?mail"],
  [".[]", "?mail", "?message"]
]
expede commented 6 months ago

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 commented 6 months ago

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