Ampersand icon indicating copy to clipboard operation
Ampersand copied to clipboard

Compile-time evaluation of enforcement rules

Open stefjoosten opened this issue 1 year ago • 2 comments

Problem

In an Ampersand script with enforcement rule R, I can reason as if R is always true because the exec engine keeps it true at all times. However, the compiler may signal violations of R that are caused by the fact that the compiler does not evaluate enforcement rules. These violations take time to diagnose and defer my attention. Besides, they force me to run a prototype, to check which violations are 'for real' and which violations are caused by not evaluating enforcement rules.

Requirement

As an Ampersand developer, I want the compiler to evaluate all enforcement rules at compile time.

Complication

I acknowledge that this feature may result in infinite loops. For this reason, we need an option on the compiler that limits the number of iterations of the exec engine.

Suggestion

I suggest we make an option [--[no-]exec [INT]]. Examples: If I specify --exec 10, the exec engine will make 10 iterations. If I specify --exec or if the option is absent, the exec engine will iterate until there is nothing more to do, so this option may cause infinite loops. If I specify --no-exec (or --no-exec INT) the exec engine will not do anything, so the compiler will terminate with certainty.

stefjoosten avatar Jul 17 '23 09:07 stefjoosten