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

new text syntax #60

Closed
Geal opened this issue Dec 22, 2020 · 3 comments
Closed

new text syntax #60

Geal opened this issue Dec 22, 2020 · 3 comments

Comments

@Geal
Copy link
Contributor

Geal commented Dec 22, 2020

I'm simplifying the text syntax, but it can still be a bit confusing, so I'd lie to propose a different version, that's further from traditional datalog syntax.
I'd like to change from:

right(#authority, $1, #read) <- resource(#ambient, $1), owner(#ambient, $0, $1)

to

right(#authority, $1, #read) if resource(#ambient, $1) and owner(#ambient, $0, $1)

with if and and case insensitive, so we can write right(#authority, $1, #read) IF resource(#ambient, $1) AND owner(#ambient, $0, $1) if it's easier to read without text highlighting

And for caveats:

caveat1($0, $1) <- right(#authority, $0, $1), resource(#ambient, $0), operation(#ambient, $1)

to

check right(#authority, $0, $1) and resource(#ambient, $0) and operation(#ambient, $1)

or another keyword, like verify, satisfy, ensures, assert, etc

For constraints, instead of moving them to the end like this:

valid_date("file1") <- time(#ambient, $0 ), resource(#ambient, "file1") @ $0 <= 2019-12-04T09:46:41+00:00

we would write:

valid_date("file1") if time(#ambient, $0 ) and resource(#ambient, "file1") and $0 <= 2019-12-04T09:46:41+00:00

And constraints could be anywhere in the rule's body, like this:

valid_date("file1") if time(#ambient, $0 ) and $0 <= 2019-12-04T09:46:41+00:00 and resource(#ambient, "file1")
@daeMOn63
Copy link

on my side I think I still prefer the current version, I find it easier to read those symbols than text for some reasons.
But this is quite subjective. If we're still moving to this, I'd suggest we keep the current constraint placement, and maybe just replace the '@' with the 'with' keyword:

valid_date("file1") if time(#ambient, $time ) and resource(#ambient, "file1") with $time <= 2019-12-04T09:46:41+00:00

mainly to ease auto formatting, I found out the following structure works quite well as it can be aligned nicely:

valid_date("file1") 
    <- time(#ambient, $time ),
       resource(#ambient, "file1") 
    @  $time <= 2019-12-04T09:46:41+00:00

keywords in place of symbols already mess it up a bit:

valid_date("file1") 
    if time(#ambient, $time )
    and resource(#ambient, "file1") 
    with $time <= 2019-12-04T09:46:41+00:00

wdyt ?

@meh
Copy link

meh commented Jan 11, 2021

I also prefer the current syntax.

@Geal Geal mentioned this issue Jan 25, 2021
17 tasks
@Geal
Copy link
Contributor Author

Geal commented Feb 25, 2022

v2 now has a new syntax with a defined grammar #72

@Geal Geal closed this as completed Feb 25, 2022
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

3 participants