title: Value/reference equality for same named function in package/namespace environments?
body: <p>Lets grab the environments "namespace:stats" and "package:stats"</p>
  
  <pre><code>ns = getNamespace( "stats" )
  pkg = as.environment( "package:stats" )
  </code></pre>
  
  <p>Now lets get the function "sd" in both:</p>
  
  <pre><code>nsSd = get( "sd" , envir = ns , inherits = FALSE )
  pkgSd = get( "sd" , envir = pkg , inherits = FALSE )
  </code></pre>
  
  <p>Are they the same?  They are!  But what does "same" mean?  Reference or value equality?</p>
  
  <pre><code>identical( nsSd , pkgSd )
  </code></pre>
  
  <p>This implies reference equality, since the following returns FALSE:</p>
  
  <pre><code>test1 = function() {}
  test2 = function() {}
  identical( test1 , test2 )
  </code></pre>
  
  <p>But if that's true, it means that an Environment's frame can contain function pointers alongside function objects.  Further complicating the issue is fact that a function can "live" in one environment, but the function can be told that its executing environment is another environment.  Chambers SoDA doesn't seem to have an answer (its a dense book, maybe I missed it!)<br>
  <br>
  So, I'd like a definitive answer.  Which of the following are correct?  Or is there a false trichotomy here?</p>
  
  <ol>
  <li><code>nsSd</code> and <code>pkgSd</code> are two different objects (albeit copies of each
  other), where the object in <code>pkgSd</code> has <code>ns</code> as its executing
  environment</li>
  <li><code>nsSd</code> and <code>pkgSd</code> are pointers to the same object.  </li>
  <li><code>nsSd</code> is a pointer to <code>pkgSd</code> and as such they are treated as identical</li>
  </ol>