Subtle parser bug
We stumbled upon a "fun" parser-related bug with @jwillis earlier today. We both have more grey hair now. Let me try to describe it in a general way. The specific problem appears in the velociraptor branch.
Let's say that we read the quantity foo:bar
with the optional value 1
. The value is not present in the file, so the parameter gets assigned the value 1
. The code then records this value in the parser structure such that it can be dumped in the used_parameters.yml
diagnostics file. So far so good.
Let's now have a second piece of code that reads foo:bar
again but this time with default value 2
. That value is still not in the file. However, this time the parser will not return 2
but it will return the 1
(i.e. the default value coming from the first call). This is because we recorded having read that 1
without storing that we did not in fact read it but defaulted to the default value.
That behaviour is not desirable as it does not match what we would expect the code to do. So, we should either prevent users from reading a given value twice (or more) or make sure that the second time we read a value, we do not return the default of the 1st call but the actual default we pass in.
@pdraper you may enjoy that bug as well.