Logical flags should default to FALSE
hadley opened this issue · 2 comments
So that you override them with something = TRUE
i.e. lazy_dt(dt, immutable = FALSE)
would be better as lazy_dt(dt, mutable = FALSE)
From @lionel: This would mean that some functions would have a quiet parameter (verbose by default), and others would have a verbose parameter (quiet by default).
Maybe the general principle is that the name should be guided by the non-default usage so that when reading code you don't get double-negatives?
This seems too arbitrary to be a general rule, sure it works in that particular example, but in many others I don't think it makes sense. e.g.
devtools::install()
has a build
argument or devools::check()
both have cran
arguments that default to TRUE
. Trying to contort their names to default to FALSE
doesn't seem worthwhile.
Also in regards to verbose
vs quiet
, I think having argument name consistency, e.g. all tidyverse functions consistently using either verbose
or quiet
would far outweigh the benefit proposed here.
This I think might be a good thing idea though
name should be guided by the non-default usage so that when reading code you avoid double-negatives
Yeah, I think the actual principle might just be: avoid creating logical arguments where the primary use is a double-negative: immutable = FALSE
, drop = FALSE
, etc