title: Use of Scala by-name parameters
body: <p>I am going through the book <a href="http://www.manning.com/bjarnason/" rel="noreferrer">"Functional Programming in Scala"</a> and have run across an example that I don't fully understand.</p>
  
  <p>In the chapter on strictness/laziness the authors describe the construction of Streams and have code like this:</p>
  
  <pre><code>sealed trait Stream[+A]
  case object Empty extends Stream[Nothing]
  case class Cons[+A](h: () =&gt; A, t: () =&gt; Stream[A]) extends Stream[A]
  
  object Stream {
      def cons[A](hd: =&gt; A, tl: =&gt; Stream[A]) : Stream[A] = {
          lazy val head = hd
          lazy val tail = tl
          Cons(() =&gt; head, () =&gt; tail)
      }
      ...
  }
  </code></pre>
  
  <p>The question I have is in the smart constructor (<code>cons</code>) where it calls the constructor for the <code>Cons</code> case class.  The specific syntax being used to pass the <code>head</code> and <code>tail</code> vals doesn't make sense to me.  Why not just call the constructor like this:</p>
  
  <pre><code>Cons(head, tail)
  </code></pre>
  
  <p>As I understand the syntax used it is forcing the creation of two Function0 objects that simply return the <code>head</code> and <code>tail</code> vals.  How is that different from just passing <code>head</code> and <code>tail</code> (without the <code>() =&gt;</code> prefix) since the <code>Cons</code> case class is already defined to take these parameters by-name anyway?  Isn't this redundant?  Or have I missed something?</p>