title: Scope of methods invoked by UseMethod
body: <p>Contrast the following two code snippets:</p>
  
  <p>1)</p>
  
  <pre><code>&gt; y &lt;- 1
  &gt; g &lt;- function(x) { 
  +   y &lt;- 2
  +   UseMethod("g")
  + }
  &gt; g.numeric &lt;- function(x) y
  &gt; g(10)
  [1] 2
  </code></pre>
  
  <p>2)</p>
  
  <pre><code>&gt; x &lt;- 1
  &gt; g &lt;- function(x) {
  +   x &lt;- 2
  +   UseMethod("g")
  + }
  &gt; g.numeric &lt;- function(y) x
  &gt; g(10)
  [1] 1
  </code></pre>
  
  <p>In the first snippet, g.numeric's free variable (namely, "y") is evaluated in g's local environment, whereas in the second snippet, g.numeric's free variable (namely "x") is evaluated in the global environment. How so?</p>