Movatterモバイル変換


[0]ホーム

URL:


Tour of Scala

Introduction

    Language

      Welcome to the tour

      This tour contains bite-sized introductions to the most frequently used featuresof Scala. It is intended for newcomers to the language.

      This is just a brief tour, not a full language tutorial. Ifyou want a more detailed guide, consider obtaininga book or takingan online courses.

      What is Scala?

      Scala is a modern multi-paradigm programming language designed to express common programming patterns in a concise, elegant, and type-safe way. It seamlessly integrates features of object-oriented and functional languages.

      Scala is object-oriented

      Scala is a pure object-oriented language in the sense thatevery value is an object. Types and behaviors of objects are described byclasses andtraits. Classes can be extended by subclassing, and by using a flexiblemixin-based composition mechanism as a clean replacement for multiple inheritance.

      Scala is functional

      Scala is also a functional language in the sense thatevery function is a value. Scala provides alightweight syntax for defining anonymous functions, supportshigher-order functions, allows functions to benested, and supportscurrying. Scala’scase classes and its built-in support forpattern matching provide the functionality of algebraic types, which are used in many functional languages.Singleton objects provide a convenient way to group functions that aren’t members of a class.

      Scala is statically typed

      Scala’s expressive type system enforces, at compile-time, that abstractions are used in a safe and coherent manner. In particular, the type system supports:

      Type inference means the user is not required to annotate code with redundant type information. In combination, these features provide a powerful basis for the safe reuse of programming abstractions and for the type-safe extension of software.

      Scala is extensible

      In practice, the development of domain-specific applications often requires domain-specific language extensions. Scala provides a unique combination of language mechanisms that make it straightforward to add new language constructs in the form of libraries.

      In many cases, this can be done without using meta-programming facilities such as macros. For example:

      Scala interoperates

      Scala is designed to interoperate well with the popular Java Runtime Environment (JRE). In particular, the interaction with the mainstream object-oriented Java programming language is as seamless as possible. Newer Java features like SAMs,lambdas,annotations, andgenerics have direct analogues in Scala.

      Those Scala features without Java analogues, such asdefault andnamed parameters, compile as closely to Java as reasonably possible. Scala has the same compilation model (separate compilation, dynamic class loading) as Java and allows access to thousands of existing high-quality libraries.

      Enjoy the tour!

      Please continue to thenext page to read more.

      Contributors to this page:

      Contents


      [8]ページ先頭

      ©2009-2025 Movatter.jp