title: How do hidden variables behave in R?
body: <p>Are there any significant [1] reasons not to export functions with names of the form .<code>fnname</code> in R packages?</p>
  
  <p>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 <code>ls</code>, and to signify that fields in an object or list should be treated as being private like the S4 .Data field. </p>
  
  <pre><code>test_env           &lt;- new.env(parent = emptyenv())
  test_env $ .hidden &lt;- 10
  
  ls(test_env)
  # character(0)
  
  ls(test_env, all.names = TRUE)
  # ".hidden"
  </code></pre>
  
  <p>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. </p>
  
  <p>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?</p>
  
  <p>Thanks for any help or info you can offer.</p>
  
  <h3>Note:</h3>
  
  <p>[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 <code>plyr</code>'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.</p>