Scala (简体中文)

From ArchWiki
翻译状态:本文是 Scala翻译。上次翻译日期:2021-01-29。如果英文版本有所更改,则您可以帮助同步翻译。

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.



$ 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.