I have set up a very simple command line argument parser (with the help of parseopt).
However, I keep getting a warning at this line:
var x = initOptParser(commandLineParams())
Here is the warning:
Warning: observable stores to 'x' [ObservableStores]
What am I doing wrong? What does the warning mean?
It means that, if there's an exception in initOptParser, you may see a change to x (an observable store), even though initOptParser didn't return. Which doesn't make much sense here, since x isn't even in scope for any code reachable after an exception. Perhaps show more of your code around this call.
Also, initOptParser() works fine; no need to pass commandLineParams(), as that's the default.
Also, initOptParser() works fine; no need to pass commandLineParams(), as that's the default.
Sometimes it's fine to do something although strictly there's no need. Sometimes you want to be explicit.
Apart from the example here where you pass a default argument, I can think of another one: You pass arguments in the same order as in the signature of a proc, but "nevertheless" use keyword arguments for clarity. I assume there are more cases where being somewhat redundant can make sense.
In this particular case I would also leave out the argument, but wanted to say that it's not generally bad style to do something that's not strictly necessary. :-)