19003, "aconsroe-hpe", "Generated '--help' could print the default value of config vars", "2022-01-14T15:28:48Z"
Using examples/hello6 as an example, using the generated
--help flag gives something like:
→ chpl examples/hello6-taskpar-dist.chpl → ./hello6-taskpar-dist -h ... hello6-taskpar-dist config vars: printLocaleName: bool tasksPerLocale: int(64)
As a user, it would be handy to see the default value of those config vars. Something like:
... hello6-taskpar-dist config vars: printLocaleName: bool = true tasksPerLocale: int(64) = 1
In this case, hello6 initializes these with a simple constant and printing them out would be straightforward.
config const printLocaleName = true; config const tasksPerLocale = 1;
Some more complicated cases would need a different strategy. That would be things like:
config const flag = true; config const x = if flag then 10 else 20; config const fileOut = "myprefix" + x:string; config const numIterations = computeGoodNumberOfIterations(x); config const split:int; split = x * 2;
In these cases, we would have to choose what to print. Some ideas would be:
- Nothing -- only print easy cases where the RHS of the init is a literal
- Source location -- print the filename and source line of the expression that declares the config
- Expression -- stringify the expression on the RHS of the init so the user could see
x: int(64) = if flag then 10 else 20