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

Nullary Predicate Syntax #52

Open
mechtaev opened this issue Nov 20, 2021 · 3 comments
Open

Nullary Predicate Syntax #52

mechtaev opened this issue Nov 20, 2021 · 3 comments
Labels

Comments

@mechtaev
Copy link
Collaborator

mechtaev commented Nov 20, 2021

Currently, nullary predicates are denoted as identifiers without parentheses, e.g. a :- b, c. @maowtm suggested to consider using the syntax with (), e.g. a() :- b(), c(). The parentheses can also be optional. Here are my thoughts about this:

Without parentheses

  • Plus: The same as in Prolog, XSB Datalog
  • Plus: Similar to the names of build stages in Dockerfiles
  • Minus: Non-intuitive for the majority of users, because the majority is not familiar with Prolog.

With parentheses

  • Plus: Intuitive for the majority of users
  • Plus: The same as in Souffle Datalog
  • Minus: When used as image predicates, something like ubuntu might be more intuitive than ubuntu(), since it is just a reference to an image, and not a call

With optional parentheses

  • Plus: Most flexible
  • Minus: It might be non-intuitive that a :- b(), c is the same as a() :- b, c()

@barr , @thevirtuoso1973 , what are your thoughts about it?

@maowtm
Copy link
Collaborator

maowtm commented Nov 20, 2021

A related thought: maybe we can solve the user error problem by making sure that we have clear error messages. When I tried a :- b() or a :- b::c() by mistake (not knowing this was not allowed) the error message did not provide any useful information. Maybe we should have a special case for this - check if there is () following a predicate, and specifically say something like "parenthesis should be omitted for nullary predicates"...?

@thevirtuoso1973
Copy link
Collaborator

I am in favour of enforcing parentheses for nullary predicates. Although I don't mind the other options.

I think the relational algebra operators would all work the same way, just that we'd be working on {()} or {}. So to be consistent, enforce p().

Regardless, it would improve readability if we just stuck to one (instead of making it optional).

@maowtm
Copy link
Collaborator

maowtm commented Nov 20, 2021

Just my personal opinion... but I actually prefer no parenthesis if we have to enforce either one or the other, since being able to just write thing :- other_thing is quite satisfying 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants