|
| 1 | +--- |
| 2 | +layout: overview |
| 3 | +title: Tour of Scala |
| 4 | +--- |
| 5 | + |
| 6 | +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. |
| 7 | + |
| 8 | +## Scala is object-oriented ## |
| 9 | +Scala is a pure object-oriented language in the sense that [every value is an object](unified_types.html). Types and behavior of objects are described by [classes](classes.html) and [traits](traits.html). Classes are extended by subclassing and a flexible [mixin-based composition](mixin-class-composition.html) mechanism as a clean replacement for multiple inheritance. |
| 10 | + |
| 11 | +## Scala is functional ## |
| 12 | +Scala is also a functional language in the sense that every function is a value. Scala provides a lightweight syntax for defining anonymous functions, it supports higher-order functions, it allows functions to be nested, and supports currying. Scala's case classes and its built-in support for pattern matching model algebraic types used in many functional programming languages. |
| 13 | + |
| 14 | +Furthermore, Scala's notion of pattern matching naturally extends to the processing of XML data with the help of right-ignoring sequence patterns. In this context, sequence comprehensions are useful for formulating queries. These features make Scala ideal for developing applications like web services. |
| 15 | + |
| 16 | +## Scala is statically typed ## |
| 17 | +Scala is equipped with an expressive type system that enforces statically that abstractions are used in a safe and coherent manner. In particular, the type system supports: |
| 18 | +* generic classes |
| 19 | +* variance annotations |
| 20 | +* upper and lower type bounds, |
| 21 | +* inner classes and abstract types as object members |
| 22 | +* compound types |
| 23 | +* explicitly typed self references |
| 24 | +* views |
| 25 | +* polymorphic methods |
| 26 | + |
| 27 | +A local type inference mechanism takes care that the user is not required to annotate the program 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. |
| 28 | + |
| 29 | +## Scala is extensible ## |
| 30 | + |
| 31 | +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 easy to smoothly add new language constructs in form of libraries: |
| 32 | +* any method may be used as an infix or postfix operator |
| 33 | +* closures are constructed automatically depending on the expected type (target typing). |
| 34 | + |
| 35 | +A joint use of both features facilitates the definition of new statements without extending the syntax and without using macro-like meta-programming facilities. |
| 36 | +Scala interoperates with Java and .NET |
| 37 | + |
| 38 | +Scala is designed to interoperate well with the popular Java 2 Runtime Environment (JRE). In particular, the interaction with the mainstream object-oriented Java programming language is as smooth as possible. Scala has the same compilation model (separate compilation, dynamic class loading) like Java and allows access to thousands of existing high-quality libraries. Support for the .NET Framework (CLR) is also available. |
| 39 | + |
| 40 | +Please continue to the next page to read more. |
0 commit comments