-
Notifications
You must be signed in to change notification settings - Fork 4
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
Eliminate default #6
Comments
I think the default method is dangerous and it would be better to throw an error. Yes, it's good to be permissive in what you expect, but accepting anything is going a bit far for not good reason. Better to throw a clear error. |
I think there is probably a design decision to be made here, and I'd like to understand your input better to increase the chances that this package is useful for someone other than myself. If I'm reading you correctly, you are implying that the function should only accept arguments of a type that has a reasonable chance of being converted into a sensible delay (e.g. numeric, POSIXct, Period, character, and difftime) but fail outright for something esoteric like a glm model? Where would that leave NULL and logical? Part of the reason I went so permissive was due to the expectation that naptime might find use in code where the delay is one of the least important running concerns and it is more important that the show go on. In that context, it is more dangerous for a bug in the code generating the delay to stop the show than it is to just carry on with a warning. However, I can see that might be a use-case with limited generalizability. Thanks again for your time and input. |
Basically, I don't understand when (say) someone would type |
I decided to follow both roads a bit. Someone might (effectively) type naptime("not implemented yet") if trying to trigger naptime in response to a 429 from an API that responded with "not implemented yet" where their documentation claimed you'd get an integer number of seconds. I agree that is horrendously unlikely that a similar error results in something like I agree that handling "not implemented yet" and However, I still see some potential utility in not allowing the sleep function to throw an error under any circumstances. So, to support that initial use case, I've got an additional option or param that most folk can feel entirely free to ignore. In cleaning up I stumbled onto an edge with how difftime objects were being handled and that will be resolved in the above PR as well. So, if you, or anybody else is experimenting with the package, it would be wise to upgrade. I'll push the update to CRAN closer to the start of December just in case anything else pops up in the interim. |
It's your package, but I think it's a dangerous design principle. Most of the most dangerous functions in base R (e.g. In your API example, a change to the API will now silently propagate and it'll be easy to miss that something is wrong with the underlying data source. |
I hear you, and (mostly) agree, that's why I overhauled things so that the above referenced cases will now throw errors. Thanks for the input, I'm pretty sure with the revised policy of throwing errors in response to ill-mannered inputs other people will find this package more useful than they may have under the initial policy of eating all errors. |
No description provided.
The text was updated successfully, but these errors were encountered: