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

chore: sketch of the power-line concept #3

Closed
wants to merge 15 commits into from
Closed

Conversation

Gozala
Copy link

@Gozala Gozala commented Feb 24, 2024

Breaking out some of the discussion points into separate issues

Signed-off-by: Irakli Gozalishvili <contact@gozala.io>
Signed-off-by: Irakli Gozalishvili <contact@gozala.io>
notes/conds.md Outdated Show resolved Hide resolved
notes/conds.md Outdated Show resolved Hide resolved
notes/conds.md Outdated Show resolved Hide resolved
notes/conds.md Outdated Show resolved Hide resolved
notes/conds.md Outdated Show resolved Hide resolved
notes/conds.md Outdated Show resolved Hide resolved
notes/conds.md Outdated Show resolved Hide resolved
notes/conds.md Outdated Show resolved Hide resolved
notes/conds.md Outdated Show resolved Hide resolved
Signed-off-by: Irakli Gozalishvili <contact@gozala.io>
Signed-off-by: Irakli Gozalishvili <contact@gozala.io>
Signed-off-by: Irakli Gozalishvili <contact@gozala.io>
notes/conds.md Outdated Show resolved Hide resolved
notes/conds.md Outdated Show resolved Hide resolved
notes/conds.md Outdated Show resolved Hide resolved
Gozala and others added 2 commits February 24, 2024 14:44
Signed-off-by: Irakli Gozalishvili <contact@gozala.io>
notes/conds.md Outdated
Comment on lines 49 to 84
### concrete proposal for the inital release

Here's a sketch that shows the features

```js
{
"iss": "did:key:alice",
// ...
"policy": [
["var", ["?x", "?y"], // The `?` here is just by convention
["args", "foo..bar.[].baz", "?x"],
[["some", "match"], "?x", "*@example.com"],

["args", "foo.quux", "?y"],
[">", "?y", 42],
["<", "?x", "?y"]
]
]
}
```

Of note:

* Selector syntax based on JSONPath / JSON Poiniter / jQ
* `"foo..bar.[].baz"` ~ `foo.{*recursive descent*}.bar.{ALL}.baz`
* `var` is like `fresh` in minikanren: introduces logic variables
* these give the ability to run predicate logic in the middle of a sector
* `[[<node>, <path>, "?x"], [<pred>, "?x", <expr>]`
* Declarative matching from `args` onwards
* Anything of the form `[<node>, <selector>, <value or variable>]`
* Can avoid namespace conflicts because users define variable names locally
* Recurses if needed
* A trivial case: `[["args", "some.path", "?x"], ["?x", "more.path", 42]]`
* Matches `args.some.path.more.path == 42`
* Use of `args` to start the path allows us to open up the synatx over time if we want
* Plus it's very declarative
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cc @Gozala thoughts?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps worth noting that the above also lets us avoid == in a lot of common cases, too:
["args", "some.path", 42] is like {==: {args: {some: {path: 42}}}}

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Odd thing about ["args", "some.path", "?x"] is that it's bit unclear if e.g. this would be valid

["", "args.some.path", "?x"] or this ["args.some", "path", "?x"]

I feel like it may make more sense to think of args as a built-in pre-poulated variable. perhaps ? could be that. Or maybe for built-in variables we could use different prefix so we could introduce new ones in the future without colliding with user defined variables.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

["", "args.some.path", "?x"]

I think that we can't run the selector on "", so it should fail, right?

perhaps ? could be that

Yeah, exatcly: I was thinking of args as that pre-populated variable. How about ?args for consistent variable syntax?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so we could introduce new ones in the future without colliding with user defined variables.

Not a bad idea, though I think it's up to the user to avoid collisions. We have a schema type in the capsule, so we know what's reserved.

We could introduce more syntax like $env ($args), which feels maybe appropriate? It's is from the $environment

notes/conds.md Outdated Show resolved Hide resolved
notes/conds.md Outdated Show resolved Hide resolved
notes/conds.md Outdated Show resolved Hide resolved
notes/conds.md Outdated Show resolved Hide resolved
notes/conds.md Outdated Show resolved Hide resolved
expede and others added 5 commits February 25, 2024 01:44
Co-authored-by: Irakli Gozalishvili <contact@gozala.io>
Signed-off-by: Brooklyn Zelenka <be.zelenka@gmail.com>
notes/conds.md Outdated Show resolved Hide resolved
notes/conds.md Outdated Show resolved Hide resolved
notes/conds.md Outdated Show resolved Hide resolved
notes/conds.md Outdated Show resolved Hide resolved
notes/conds.md Show resolved Hide resolved
notes/conds.md Show resolved Hide resolved
notes/conds.md Outdated Show resolved Hide resolved
Co-authored-by: Irakli Gozalishvili <contact@gozala.io>
Signed-off-by: Brooklyn Zelenka <be.zelenka@gmail.com>
notes/conds.md Show resolved Hide resolved
notes/conds.md Outdated Show resolved Hide resolved
Co-authored-by: Vasco Santos <santos.vasco10@gmail.com>
Signed-off-by: Irakli Gozalishvili <contact@gozala.io>
@Gozala Gozala closed this Jul 9, 2024
@smoyer64 smoyer64 mentioned this pull request Jul 22, 2024
20 tasks
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

Successfully merging this pull request may close these issues.

3 participants