-
Notifications
You must be signed in to change notification settings - Fork 46
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix runApplication handling of unrecognized command-line args #134
Fix runApplication handling of unrecognized command-line args #134
Conversation
`runApplication` takes an `args_out` parameter which, if non-null, is supposed to be set to match unrecognized command-line args. However, the parameter is never passed to `finalizeCommandLineOptions`, which will therefore log an error and throw an exception if any command line arguments are unrecognized. This patch fixes the oversight, ensuring that `runApplication` will correctly populate a non-null `args_out` parameter with unrecognized command-line arguments, and not throw an exception in this case.
As a side remark: this design seems a bit intrusive in how it handles arguments. I get that the intent must be to allow |
What's not entirely clear to me is the intended usage of this I can make guesses about what that intended usage is, but it'd be good to have it clearly explained by someone behind the design of this code. |
I agree about the lack of beauty of this functionality, it's a relic of the beginnings where the primary idea was to replicate the scripting language experience and to avoid any boilerplate code during initialization. The For An immediate improvement would be to add a second overload of |
@s-ludwig makes sense, thanks for giving the context and history. If there's long-term scope for some significant re-thinking of how vibe-core works, I might have some interest in following up on that. I won't commit to anything now, but I may drop you a line some time in the future if this becomes more than just a line of thought. |
I may be overlooking something now, but I think it really is just the command line handling, the main part of vibe-core is meant to remain in its current form for the time being. Do you have any thoughts about other areas? |
Nothing too explicit for now, as it's quite a speculative line of thought which needs to be properly researched before offering an opinion. But the core of it is about ensuring that we have a very nice, flexible, and simple-to-use async-io-based task system, with easy interactions with stuff like streams. There are a few different implementations of that -- vibe.d, the task framework in sociomantic's ocean library, weka.io's |
runApplication
takes anargs_out
parameter which, if non-null, is supposed to be set to match unrecognized command-line args. However, the parameter is never passed tofinalizeCommandLineOptions
, which will therefore log an error and throw an exception if any command line arguments are unrecognized.This patch fixes the oversight, ensuring that
runApplication
will correctly populate a non-nullargs_out
parameter with unrecognized command-line arguments, and not throw an exception in this case.