実行

>type HelloWorld.scala
object HelloWorld {
  def main(args: Array[String]): Unit = {
    System.out.println("Hello, Scala!")
  }
}

>scalac HelloWorld.scala

>scala HelloWorld
Hello, Scala!
>type HelloWorldSJIS.scala
object HelloWorld {
  def main(args: Array[String]): Unit = {
    System.out.println("Hello, Scala! 日本語")
  }
}

>scalac HelloWorldSJIS.scala

>scala HelloWorld
Hello, Scala! 日本語

e:\temp\scala>type HelloWorldUTF8.scala
object HelloWorld {
  def main(args: Array[String]): Unit = {
    System.out.println("Hello, Scala! 譌・譛ャ隱・)
  }
}

>scalac HelloWorldUTF8.scala
IO error while decoding HelloWorldUTF8.scala with windows-31j
Please try specifying another one using the -encoding option

>scalac -encoding UTF-8 HelloWorldUTF8.scala

>scala HelloWorld
Hello, Scala! 日本語


scala -e "print(\"hoge\")" は実行できるが
scalc xxxx.scala はどうも実行できないようだ。

>scala -e "print(\"hoge\")"
hoge
>scala HelloWorld.scala
(virtual file):1: error: block must end in result expression, not in definition
object Main {
   ^
one error found
!!!
discarding <script preamble>
discarding (fragment of HelloWorld.scala)


scalac -helpしてもなぜかscalacのヘルプになる?

>scala -help
scalac [ <option> ]... [<torun> <arguments>]

All options to scalac are allowed.  See scalac -help.

<torun>, if present, is an object or script file to run.
If no <torun> is present, run an interactive shell.

Option -howtorun allows explicitly specifying how to run <torun>:
    script: it is a script file
    object: it is an object name
    guess: (the default) try to guess

Option -i requests that a file be pre-loaded.  It is only
meaningful for interactive shells.

Option -e requests that its argument be executed as Scala code.

Option -savecompiled requests that the compiled script be saved
for future use.

Option -nocompdaemon requests that the fsc offline compiler not be used.

Option -Dproperty=value sets a Java system property.

なんでだろう?

雑感

言語仕様はいいけど、なんかとっつきづらい。
なんでvoidじゃなくてUnitなんだろうとか、import で * じゃなくて _ とか。