Scala (简体中文) - ArchWiki

Jump to content

# Scala (简体中文)

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

Related articles

- Java

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-docs 和 scala-sources 。

因为 scala 运行在 JVM (Java Virtual Machine) 上，所以为了编译和运行 scala 程序，您也需要一个完整的 Java Runtime Environment (JRE)。

对于 scala3 (也被称作 dotty), 您可以从 AUR 中安装 scala3AUR 或者 scala-dottyAUR。 请注意 scala3 不兼容 scala 2.13 及更早版本.

### 构建工具

多数构建工具可以在官方 community 仓库中安装:

- sbt
- maven
- gradle

## 使用和 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 例如 Eclipse 和 Netbeans 都提供 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.

## 参见

- Scala Lang - 官方网站
- Scala Tutorial - 一系列小型 scala 入门教程
- Learn X=Scala in Y minutes

Category:

- Programming languages (简体中文)