Are there any significant [1] reasons not to export functions with names of the form .fnname
in R packages?
I understand that the main use of dot-prefixed variables is to denote a variable as being hidden when searching through an environment using functions like ls
, and to signify that fields in an object or list should be treated as being private like the S4 .Data field.
test_env <- new.env(parent = emptyenv())
test_env $ .hidden <- 10
ls(test_env)
# character(0)
ls(test_env, all.names = TRUE)
# ".hidden"
As far as I can tell the convention is enforced at the level of a few utility environment-searching functions but not throughout the R language as a whole.
Does dot-prefixing a variable alter the behaviour of core language features like lexical scoping or the various object systems, and if so would this make exporting dot-prefixed functions inappropriate or dangerous?
Thanks for any help or info you can offer.
Note:
[1] By significant I mean non-stylistic; the library in question uses special prefixes and suffixes to flag aspects of a function's type signature, somewhat like plyr
's special naming convention. It would normally be non-semantic to abuse dot-prefixed variables, but in this case it is worth the compounded meaning.