Remove imperative part of the command_def module, to avoid forcing lazy evaluation when unnecessary
The command_def module, as of to day, parses value and change constants.
We would better:
- Use custom lazy type when parsing ([with
--editor
option]), allowing to evaluate later in some case, and avoid evaluation, and corresponding exception, in some other. Further more, we could debug value lazily, when needed, instead of forcing evaluation, like here. - Use Const.ml value as true constants in the code (like this one).
Consequently, the get_var function would be moved, maybe placed in a standalone module. The mutation would be replaced by passing all arguments to each command (change here).