mirror of
https://github.com/open-policy-agent/opa.git
synced 2026-08-13 03:42:35 -06:00
7ca542adb5
Previously, functions were implemented with a separate set of types that had their own code paths in the compiler, eval, etc. These changes refactor the function implementation so that functions are implemented as rules with one or more arguments. By representing functions as rules, we can avoid special casing required to support functions, e.g., during parse and compile there are a number of steps that required special casing for functions: - Parser needed separate grammar definitions for functions (which prevented them from being chained or using else) - Compiler needed separate resolver and type checker implementations which was a source of bugs. In some cases, special casing is unavoidable for now (e.g., during eval) however this could be improved in the future. Fixes #471 Fixes #467 Fixes #463