Scala

出自 Arch Linux 中文维基

From Wikipedia:

Scala is an object-functional programming and scripting language for general software applications. Scala has full support for functional programming (including currying, pattern matching, algebraic data types, lazy evaluation, tail recursion, immutability, etc.) and a very strong static type system. This allows programs written in Scala to be very concise and thus smaller in size than most general purpose programming languages. Many of Scala's design decisions were inspired by criticism over the shortcomings of Java.

安裝[編輯 | 編輯原始碼]

official repositories安裝 scala。此外您也可以選擇安裝 scala-docsscala-sources

因為 scala 運行在 JVM (Java Virtual Machine) 上,所以為了編譯和運行 scala 程序,您也需要一個完整的 Java Runtime Environment (JRE)。

對於 scala3 (也被稱作 dotty), 您可以從 AUR 中安裝 scala3AUR 或者 scala-dottyAUR。 請注意 scala3 不兼容 scala 2.13 及更早版本.

構建工具[編輯 | 編輯原始碼]

多數構建工具可以在官方 community 倉庫中安裝:

使用和 IDE[編輯 | 編輯原始碼]

Python 等語言一樣, 您可以在解釋器中運行交互程序。

$ scala

Welcome to Scala version 2.*.* (OpenJDK Server VM, Java 1.*.*).
Type in expressions to have them evaluated.
Type :help for more information.

scala>

也可以簡單地從命令行編譯並運行程序。

$ scalac HelloWorld.scala
$ scala HelloWorld

許多不同的 IDE 例如 EclipseNetbeans 都提供 scala 支持。 scala-ideAUR package for example is available in the AUR. But you can also download an IDE that is optimized for Scala and also based on Eclipse directly from the official Scala Website.

參見[編輯 | 編輯原始碼]