title: What is the purpose of type ascriptions in Scala?
body: <p>There's not much info in the spec on what type ascription is, and there certainly isn't anything in there about the purpose for it.  Other than "making passing varargs work", what would I use type ascription for?  Below is some scala REPL for the syntax and effects of using it.</p>
  
  <pre><code>scala&gt; val s = "Dave"
  s: java.lang.String = Dave
  
  scala&gt; val p = s:Object
  p: java.lang.Object = Dave
  
  scala&gt; p.length
  &lt;console&gt;:7: error: value length is not a member of java.lang.Object
         p.length
           ^
  scala&gt; p.getClass
  res10: java.lang.Class[_ &lt;: java.lang.Object] = class java.lang.String
  
  scala&gt; s.getClass
  res11: java.lang.Class[_ &lt;: java.lang.Object] = class java.lang.String
  
  scala&gt; p.asInstanceOf[String].length
  res9: Int = 4
  </code></pre>