Skip to content

Allow user-defined zero-argument functions in Rego #6315

Open
@johanfylling

Description

It's possible to declare functions with zero arguments in Rego:

package example

foo() := 1

these are however treated as regular rules, and there is no semantic difference between the above policy and:

package example

foo := 1

This is cause for confusion, as the user likely expects foo() to behave as a function (e.g. not contribute to output document), but it will actually behave as a rule.

Alternatively, it should be a parser error to declare a zero-arg rule.

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    • Status

      Nice To Have

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions