title: Block in Ruby compared to Smalltalk
body: <p>What does block in Ruby mean?  It looks similar with Smalltalk, but you can't send messages to it.</p>
  
  <p>For example, in smalltalk:</p>
  
  <pre><code>[:x | x + 3] value: 3
  </code></pre>
  
  <p>returns 6.  But in ruby:</p>
  
  <pre><code>{|x| x + 3}.call 3
  </code></pre>
  
  <p>will cause SyntaxError.</p>
  
  <p>Well, you can pass messages to lambda in ruby, though:</p>
  
  <pre><code>irb(main):025:0&gt; -&gt;(x){x+3}.call 3
  =&gt; 6
  </code></pre>
  
  <p>So in Ruby, block is not a block, but lambda is a block?   Is this true? I mean, are there any differences between ruby lambda and smalltalk block?  If this is true, then what is a ruby block?</p>
  
  <p>Update:  </p>
  
  <p>From the comment and answer below, together with some googling, I guess I
  have more understanding of Ruby block.  In Ruby,  usually a piece of code evaluates an value, and every value is an object.  But, block doesn't evaluate an value.  So it's not an object.  Instead it can act as <em>part</em> of an object.  For example, in {|x| x + 3} can act as a part of the object proc {|x| x + 3 }.</p>
  
  <p>But it did confuse me.  In smalltalk, almost every expression can be divided into objects (binding to variables are exceptions).  It seems in Ruby, there are more exceptions.</p>