libminizinc
libminizinc copied to clipboard
Feature request: Defining enums in let-blocks
I would like the following code to be valid
constraint
let {
enum Foo = {Bar};
} in true;
Currently (version 2.6.3) this just generates MiniZinc: syntax error: syntax error, unexpected enum
.
While the above code is not interesting, using enums in let
-blocks can be useful when constructing data-structures inside constraints, predicates, and functions. For example, when creating a finite automata for regular
, using an enum enum States = State(1..nstates)
could make the code clearer.
It does sound like there are interesting use cases for this. At the moment this might be a bit tricky to implement since both the identifiers of enumerated types and their elements populate the global namespace.