title: Ruby block, procs and instance_eval
body: <p>I recently tried to do something akin to this:</p>
  
  <pre><code>a = "some string"
  b = Proc.new{ upcase }
  a.instance_eval b
  </code></pre>
  
  <p>Which gives the error:</p>
  
  <blockquote>
    <p>TypeError: can't convert Proc into String</p>
  </blockquote>
  
  <p>but this works:</p>
  
  <pre><code>def b(&amp;block)
    "some string".instance_eval &amp;block
  end
  
  b{ upcase }
  </code></pre>
  
  <p>A further look with this method:</p>
  
  <pre><code>def b(&amp;block)
    "some string".instance_eval block
  end
  </code></pre>
  
  <p>Yields the same <code>Proc to String</code> error.</p>
  
  <p>So...  my understanding of blocks is that they are just procs.  But there's obviously something special about having this <code>&amp;</code> ampersand...</p>
  
  <p>Can someone explain this to me?  Is it possible to convert a normal proc to be whatever it is that is special about this <code>&amp;block</code> object?</p>
  
  <h3>edit</h3>
  
  <p>Just figured out my second question, prepend an <code>&amp;</code> to the proc...  that was easy,  but WHAT is this really doing?</p>