Closed travv0 closed 3 years ago
I agree that this wording is a bit unfortunate, and that changing it would be better. But as versioning in common lisp is not really that common I think that a breaking change would not be the best solution, but instead rewording it is better. I understand that it is really annoying that you cannot pass an empty list to the method, so we would have to think of workaround for that.
Yeah, I figured you'd want to play it safe but I figured I'd ask. Once I figured out the issue I was having, it was easy enough to do (when args (opts:get-opts args))
as a workaround since if you're wanting to give it an empty list, you're expecting back an empty list.
I think a form of helper function would be nice, so that any default arguments can still be parsed. Something like a special (defun possibly-empty (args) (if args args 'empty-list)
.
You mean to be used like (opts:get-opts (possibly-empty args))
?
Maybe a keyword argument for specifying how an empty list/nil should be handled would be more idiomatic?
Sorry for my absence, but when looking at the code it seems like we already do this, when options
is supplied it is used, even when it is nil
. So I'm not entirely sure what is happening.
You're sure right, at the time I made this issue I was accidentally using an older version that was cloned by another project's makefile, but I see it's been fixed since. Sorry about that!
This seems to not match up with the behavior described in its docstring which states:
This led me to believe that
argv
would only be used when the optional argument wasn't passed, not whennil
was passed as the optional argument.I can submit a pull request if you'd like, but I wanted to get your thoughts first since this change would potentially be breaking.