forester icon indicating copy to clipboard operation
forester copied to clipboard

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

Open bokov opened this issue 2 years ago • 1 comments

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.

bokov avatar Mar 29 '23 02:03 bokov

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

HubertR21 avatar Mar 30 '23 08:03 HubertR21