Skip to content
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

The save() function and the principle of least surprise. #108

Open
bokov opened this issue Mar 29, 2023 · 1 comment
Open

The save() function and the principle of least surprise. #108

bokov opened this issue Mar 29, 2023 · 1 comment

Comments

@bokov
Copy link

bokov commented Mar 29, 2023

Instead of overriding the base::save() function, could you just give yours a new name like forester_save() or something like that?

Otherwise you break the user's ability to save R objects unrelated to forester.

If for some reason you must override save(), can you please alter your function to use a compatible syntax with base::save() by doing the following:

  • Have the third argument be named file instead of name.
  • Get rid of the fourth argument, path because name can be a bare file name, a full path, or a relative path and that's how all other save functions in R handle it.
  • Include ... at the end of the signature so you can collect any save() arguments that forester::save() doesn't use and pass them to base::save(). Or at least ignore them instead of erroring which is what currently happens if the user uses an argument supported by base::save() but not forester::save().

This is very easy to do, and I'll be happy to submit a PR if that's something you would approve. Please let me know.

@HubertR21
Copy link
Collaborator

Hi, thank you for a valuable comment, we will definitely address that in the near future.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants