title: scala: How can I pass a 0-arg function somewhere without calling it?
body: <pre><code>def myfunc():Int = 10
  class FuncUser( val func:()=&gt;Int )
  val i = new FuncUser( myfunc ) 
  </code></pre>
  
  <p>This fails because myfunc is immediately evaluated -- its type is Int, not ()=>Int
  How can directly pass myfunc to the FuncUser constructor?</p>
  
  <p>Also, this works:</p>
  
  <pre><code>val y4:()=&gt;Int = myfunc
  val j = new FuncUser( y4 )
  </code></pre>
  
  <p>but I'm confused about why the first line succeeds? Why isn't myfunc also immediately evaluated in this second example?</p>