Logical
Logical copied to clipboard
Refactor variable
Variable should be more easily assignable, because right now is a little bit cumbersome. ~~Also the variable needs to be more expressive, so it should be a record instead of a simple string.~~
Variable's module should have constructor for every kind variable type.
Another issue is that you can only get the variable's value by calling State's value_of, which is not problem, but maybe it should live in Variable's module.
Variable module would have:
- type specific constructors which would give back a goal, so it would be just an abstraction over Goal.equal
- value_of function which has a variable_name and a state input and returns the value of the variable and this return value can either be a success or a failure(option and an exception version)
Adding namespace to a variable also could be included in this issue. Adding namespace would make sense, because:
- It could make the variable more unique
- Namespace could be used easily to map to a configuration's field
I'm not sure about adding namespaces, because it add an unnecessary overhead when the namespace could be part of the variable's name.