r-lib/withr

Should the parameter `tmpdir` be superseded by a new `tempdir` parameter?

Closed this issue · 2 comments

If you look at the signature for {withr} functions that work with temporary directories and files,

with_tempdir(
  code,
  clean = TRUE,
  pattern = "file",
  tmpdir = tempdir(),
  fileext = ""
)

both the function suffix (_tempdir) and the default argument (tempdir()) follow the same naming pattern: tempdir.

But the function parameter is instead called tmpdir (notice the missing e), and this naming inconsistency always trip me (and maybe others as well?) up while specifying a named argument.

Do you think it makes sense to supersede this parameter with a new parameter called tempdir?

Do you think it makes sense to supersede this parameter with a new parameter called tempdir?

This naming comes directly from the function tempfile() in base R. And it is probably inspired by the environment variable TMPDIR, so changing this is probably a bad idea.

Good idea to not break the convention then.