This journey contains some concise introductions: introducing the most commonly used functions of Scala. It is designed to help newbies learn the language.
This is just a brief introduction, not a complete language tutorial. If you can, consider buying this book or checking out other resources.
Scala is a modern multi-paradigm programming language designed to express common programming patterns in a concise, elegant and type-safe way. It smoothly integrates features of object-oriented and functional languages.
Scala is a pure object-oriented language, in a sense all values are objects. Object types and behaviors are described by classes and traits. Classes are extended through subclassing and a flexible mixin-based composition mechanism to become a complete replacement for multiple inheritance.
Scala is still a functional language. In a sense, all functions are values. Scala provides a lightweight syntax for defining anonymous functions, supports higher-order functions, allows function nesting, and supports currying. Scala's sample classes and its built-in support for pattern matching model algebraic types are used in many functional programming languages. Singleton objects provide a convenient way to group functions that are not members of a class.
Furthermore, Scala's pattern matching concepts naturally extend to XML data processing by means of ignoring right sequence patterns, through the general extension via extractor objects. In this case, the for comprehension helps in formulating the query. These features make Scala ideal for developing applications such as web services.
Scala is equipped with an expression type system that statically enforces the use of abstractions in a safe and consistent manner. Specifically, the type system supports:
Generic classes
Deformation annotations
The above is the detailed content of [TOUR OF Scala] 1-Introduction - TOUR OF SCALA. For more information, please follow other related articles on the PHP Chinese website!