title: When are Scala Semicolons required
body: <p>I am trapped at work with a locked down pc. But I am trying to practice my Scala. I am using Ideone.com since I can't even install <code>scalac</code>...</p>
  
  <p>Anyway this is not compiling:</p>
  
  <pre><code>class DPt(var name: String, var x: Double, var y: Double){
  
          def print = println("DPt; name: " + name + " x: " + x + " y: " + y)
  }
  
  
  object Main {
    def main(args: Array[String]) {
          val pt0 = new DPt("Joe", 1.0, 1.0)
          println("checking generated accessor: " + pt0.x)
          pt0 print
          pt0.x_=(3.0)
          pt0 print
    }
  }
  </code></pre>
  
  <p>I get this message back from the Ideone.com scala compiler:</p>
  
  <pre><code>Main.scala:12: error: Unit does not take parameters
      pt0 print
              ^
  one error found
  spoj: The program compiled successfully, but Main.class was not found.
        Class Main should contain method: def main(args: Array[String]).
  </code></pre>
  
  <p>However, when I add semicolons to the end of the statements, like this:</p>
  
  <pre><code>class DPt(var name: String, var x: Double, var y: Double){
  
          def print = println("DPt; name: " + name + " x: " + x + " y: " + y)
  }
  
  
  object Main {
    def main(args: Array[String]) {
          val pt0 = new DPt("Joe", 1.0, 1.0);
          println("checking generated accessor: " + pt0.x);
          pt0 print;
          pt0.x_=(3.0);
          pt0 print;
    }
  }
  </code></pre>
  
  <p>I find the infix and postfix notation in Scala to be <em>AWESOME</em>, But I must be missing something. Why doesn't Scala consider the end of the line to be the end of the statement?</p>
  
  <hr>
  
  <p>Second poster on this blog seems to have the answer. The Scala people should get on this. Such an annoyance.... Although this is about the first annoying this I've encountered in this otherwise beautiful language.
  <a href="http://www.scala-lang.org/node/4143" rel="nofollow noreferrer">http://www.scala-lang.org/node/4143</a></p>
  
  <p>Another explanation straight from the documentation: 
  <a href="http://docs.scala-lang.org/style/method-invocation.html" rel="nofollow noreferrer">http://docs.scala-lang.org/style/method-invocation.html</a></p>