Subject: | Allow lazy variable expansion |
AppConfig performs expansion immediatly when parsing a file, meaning variable definition order matters.
a = $b
b = 1
=> won't work
Morevoer, in multiple configuration file scenarios, it doesn't allow easy variable redefinition, as any subsequent including variable as to be redefined also
a = 1
b = $a
a = 2
=> b still equals 1
The following patch add a new value EXPAND_LAZY to expansion policy, that allows variable to get expanded at retrieval time, instead of insertion time. It does this by moving _expand method from File to State, renaming it to _substitue to avoid name clash (additional benefit: should allow variable expansion from elsewhere as file, such as command line options), and adding it an additional context parameter.
Additional tests are also included in the patch.
Message body is not shown because it is too large.