Closed ngreifer closed 2 years ago
Thanks @ngreifer - we'll think about this
I've implemented - the only limitation is that if the argument has a default it considers the argument to not be missing. I don't think this can be avoided because by definition chk_missing() is nested within the parent function and as the help file for missing states
Currently missing can only be used in the immediate body of the function that defines the argument, not in the body of a nested function or a local call. This may change in the future.
This looks great, thank you! If the argument has a default, it should not be considered missing, so this is correct behavior in my opinion.
That second part is a limitation, but not one I know how to deal with. It is possible to create a missing value to compare something to, but as soon as it is passed to nested functions it attempts to evaluate the argument. Still, for basic argument checking, it is helpful.
This old thread has been automatically locked. If you think you have found something related to this, please open a new issue and link to this old issue if necessary.
It would be great if there could be a
chk_
andvld_
for a missing argument, i.e., when a function's formal argument has no default and the user doesn't supply anything to it, something likeis.missing()
but with thechk
sugar around it. It might also be cool to have a check for whether the supplied argument is missing in all checking functions. Thanks!