-
Notifications
You must be signed in to change notification settings - Fork 109
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
What convention for option names should be used? #111
Comments
Or even |
I don't have strong opinions but it would be nice if we happen to choose one of the conventions we are already using 🙂 then at least some of our actual option names will be compliant. I do have a modest preference for |
I think it'd be better if we had the same soft-namespacing convention everywhere, e.g. for S3 classes and attributes. Whereas dots are ok for options, they wouldn't be ok for S3 classes. For this reason I have a preference for underscore.
I like that but the problem is that it forces quoting the name, which might be user-unfriendly. |
@jennybc given the inability to use |
I can let go of my scheme and to with |
Any news on this, i.e. did you make a final decision yet? If you cannot use |
Did we decide on a syntax here? |
There was an internal poll on Slack where the favourite style was |
It is good to have a formalization, at least. So, the standard for a multi-word option name would be |
I think we might need to reconsider the option naming scheme if we're thinking of providing a wrapper like |
Would
On the downside, foo <- structure(as.environment(options()), class = "foo")
bench::mark(
foo$width,
getOption("width"),
iterations = 10e4
)
#> # A tibble: 2 × 13
#> expression min median `itr/sec` mem_alloc `gc/sec` n_itr
#> <bch:expr> <bch> <bch:> <dbl> <bch:byt> <dbl> <int>
#> 1 foo$width 0 83ns 4738650. 0B 47.4 99999
#> 2 getOption("width") 333ns 458ns 2050965. 0B 0 100000 |
As with much of base R, the style for global option names is inconsistent. To take a few examples from the documentation:
Within RStudio-adjacent packages, there seems to be a mix of styles (see discussion here)
Jenny Bryan suggests using
package.option_name
as a standard.Is it worth adding this to the official style guide, for reference, going forward?
The text was updated successfully, but these errors were encountered: